Range-v3
Range algorithms, views, and actions for the Standard Library
range_for.hpp File Reference

Macros

#define RANGES_FOR(VAR_DECL, ...)
 A range-based for macro, basically a hack until the built-in range-for can handle Ranges that have a different type for begin and end. More...
 

Macro Definition Documentation

◆ RANGES_FOR

#define RANGES_FOR (   VAR_DECL,
  ... 
)
Value:
if(bool CPP_PP_CAT(_range_v3_done, __LINE__) = false) {} \
else \
for(auto && CPP_PP_CAT(_range_v3_rng, __LINE__) = (__VA_ARGS__); \
!CPP_PP_CAT(_range_v3_done, __LINE__);) \
for(auto CPP_PP_CAT(_range_v3_begin, __LINE__) = \
ranges::begin(CPP_PP_CAT(_range_v3_rng, __LINE__)); \
!CPP_PP_CAT(_range_v3_done, __LINE__); \
CPP_PP_CAT(_range_v3_done, __LINE__) = true) \
for(auto CPP_PP_CAT(_range_v3_end, __LINE__) = \
ranges::end(CPP_PP_CAT(_range_v3_rng, __LINE__)); \
!CPP_PP_CAT(_range_v3_done, __LINE__) && \
CPP_PP_CAT(_range_v3_begin, __LINE__) != \
CPP_PP_CAT(_range_v3_end, __LINE__); \
++CPP_PP_CAT(_range_v3_begin, __LINE__)) \
if(!(CPP_PP_CAT(_range_v3_done, __LINE__) = true)) {} \
else \
for(VAR_DECL = *CPP_PP_CAT(_range_v3_begin, __LINE__); \
CPP_PP_CAT(_range_v3_done, __LINE__); \
CPP_PP_CAT(_range_v3_done, __LINE__) = false) \
constexpr _begin_::fn begin
Definition: access.hpp:182
constexpr _end_::fn end
Definition: access.hpp:313

A range-based for macro, basically a hack until the built-in range-for can handle Ranges that have a different type for begin and end.