1// Copyright (c) 2023 Klemens D. Morgenstern
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5#ifndef BOOST_COBALT_COBALT_FOR_HPP
6#define BOOST_COBALT_COBALT_FOR_HPP
7
8#include <boost/preprocessor/cat.hpp>
9
10#define BOOST_COBALT_FOR_IMPL(Value, Expression, Id) \
11for (auto && Id = Expression; Id; ) \
12 if (Value = co_await Id; false) {} else
13
14#define BOOST_COBALT_FOR(Value, Expression) \
15 BOOST_COBALT_FOR_IMPL(Value, Expression, BOOST_PP_CAT(__boost_cobalt_for_loop_value__, __LINE__))
16
17#endif //BOOST_COBALT_COBALT_FOR_HPP
18

source code of boost/libs/cobalt/include/boost/cobalt/async_for.hpp