Header file range/v3/range_for.hpp

#include <range/v3/range_fwd.hpp>

#include <range/v3/begin_end.hpp>

#define RANGES_FOR(VAR_DECL, ...) if(bool _range_v3_done = false) {}                                                              else for(auto && _range_v3_rng = (__VA_ARGS__); !_range_v3_done;)                                   for(auto _range_v3_begin = ranges::begin(_range_v3_rng); !_range_v3_done;                               _range_v3_done = true)                                                                      for(auto _range_v3_end = ranges::end(_range_v3_rng);                                                    !_range_v3_done && _range_v3_begin != _range_v3_end; ++_range_v3_begin)                     if(!(_range_v3_done = true)) {}                                                                 else for(VAR_DECL = *_range_v3_begin; _range_v3_done; _range_v3_done = false)

Macro RANGES_FOR

#define RANGES_FOR(VAR_DECL, ...) if(bool _range_v3_done = false) {}                                                              else for(auto && _range_v3_rng = (__VA_ARGS__); !_range_v3_done;)                                   for(auto _range_v3_begin = ranges::begin(_range_v3_rng); !_range_v3_done;                               _range_v3_done = true)                                                                      for(auto _range_v3_end = ranges::end(_range_v3_rng);                                                    !_range_v3_done && _range_v3_begin != _range_v3_end; ++_range_v3_begin)                     if(!(_range_v3_done = true)) {}                                                                 else for(VAR_DECL = *_range_v3_begin; _range_v3_done; _range_v3_done = false)

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