Warning, file /include/range/v3/range_for.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef RANGES_V3_RANGE_FOR_HPP
0015 #define RANGES_V3_RANGE_FOR_HPP
0016
0017 #include <range/v3/range_fwd.hpp>
0018
0019 #include <range/v3/range/access.hpp>
0020
0021 #if RANGES_CXX_RANGE_BASED_FOR < RANGES_CXX_RANGE_BASED_FOR_17
0022
0023
0024 #define RANGES_FOR(VAR_DECL, ...) \
0025 if(bool CPP_PP_CAT(_range_v3_done, __LINE__) = false) {} \
0026 else \
0027 for(auto && CPP_PP_CAT(_range_v3_rng, __LINE__) = (__VA_ARGS__); \
0028 !CPP_PP_CAT(_range_v3_done, __LINE__);) \
0029 for(auto CPP_PP_CAT(_range_v3_begin, __LINE__) = \
0030 ranges::begin(CPP_PP_CAT(_range_v3_rng, __LINE__)); \
0031 !CPP_PP_CAT(_range_v3_done, __LINE__); \
0032 CPP_PP_CAT(_range_v3_done, __LINE__) = true) \
0033 for(auto CPP_PP_CAT(_range_v3_end, __LINE__) = \
0034 ranges::end(CPP_PP_CAT(_range_v3_rng, __LINE__)); \
0035 !CPP_PP_CAT(_range_v3_done, __LINE__) && \
0036 CPP_PP_CAT(_range_v3_begin, __LINE__) != \
0037 CPP_PP_CAT(_range_v3_end, __LINE__); \
0038 ++CPP_PP_CAT(_range_v3_begin, __LINE__)) \
0039 if(!(CPP_PP_CAT(_range_v3_done, __LINE__) = true)) {} \
0040 else \
0041 for(VAR_DECL = *CPP_PP_CAT(_range_v3_begin, __LINE__); \
0042 CPP_PP_CAT(_range_v3_done, __LINE__); \
0043 CPP_PP_CAT(_range_v3_done, __LINE__) = false) \
0044
0045
0046 #else
0047 #define RANGES_FOR(VAR_DECL, ...) for(VAR_DECL : (__VA_ARGS__))
0048 #endif
0049
0050 #endif