Apache Mesos
Macros
foreach.hpp File Reference
#include <tuple>
#include <utility>
#include <stout/preprocessor.hpp>

Go to the source code of this file.

Macros

#define STOUT_FOREACH_PREFIX   CAT(__foreach_, __LINE__)
 
#define STOUT_FOREACH_BODY   CAT(STOUT_FOREACH_PREFIX, _body__)
 
#define STOUT_FOREACH_BREAK   CAT(STOUT_FOREACH_PREFIX, _break__)
 
#define STOUT_FOREACH_CONTINUE   CAT(STOUT_FOREACH_PREFIX, _continue__)
 
#define STOUT_FOREACH_ELEM   CAT(STOUT_FOREACH_PREFIX, _elem__)
 
#define STOUT_FOREACH_ONCE   CAT(STOUT_FOREACH_PREFIX, _once__)
 
#define foreach(ELEM, ELEMS)   for (ELEM : ELEMS)
 
#define foreachpair(KEY, VALUE, ELEMS)
 
#define foreachkey(KEY, ELEMS)   foreachpair (KEY, std::ignore, ELEMS)
 
#define foreachvalue(VALUE, ELEMS)   foreachpair (std::ignore, VALUE, ELEMS)
 

Macro Definition Documentation

#define foreach (   ELEM,
  ELEMS 
)    for (ELEM : ELEMS)
#define foreachkey (   KEY,
  ELEMS 
)    foreachpair (KEY, std::ignore, ELEMS)
#define foreachpair (   KEY,
  VALUE,
  ELEMS 
)
Value:
foreach (auto&& STOUT_FOREACH_ELEM, ELEMS) \
if (false) STOUT_FOREACH_BREAK: break; /* set up the break path */ \
else if (bool STOUT_FOREACH_CONTINUE = false) {} /* var decl */ \
else if (true) goto STOUT_FOREACH_BODY; /* skip the loop exit checks */ \
else for (;;) /* determine whether we should break or continue. */ \
if (!STOUT_FOREACH_CONTINUE) goto STOUT_FOREACH_BREAK; /* break */ \
else if (true) break; /* continue */ \
if (bool STOUT_FOREACH_ONCE = false) {} /* var decl */ \
else for (KEY = std::get<0>( \
std::forward<decltype(STOUT_FOREACH_ELEM)>( \
for (VALUE = std::get<1>( \
std::forward<decltype(STOUT_FOREACH_ELEM)>( \
#define STOUT_FOREACH_CONTINUE
Definition: foreach.hpp:24
#define STOUT_FOREACH_ELEM
Definition: foreach.hpp:25
#define STOUT_FOREACH_BODY
Definition: foreach.hpp:22
#define STOUT_FOREACH_BREAK
Definition: foreach.hpp:23
#define STOUT_FOREACH_ONCE
Definition: foreach.hpp:26
#define foreachvalue (   VALUE,
  ELEMS 
)    foreachpair (std::ignore, VALUE, ELEMS)
#define STOUT_FOREACH_BODY   CAT(STOUT_FOREACH_PREFIX, _body__)
#define STOUT_FOREACH_BREAK   CAT(STOUT_FOREACH_PREFIX, _break__)
#define STOUT_FOREACH_CONTINUE   CAT(STOUT_FOREACH_PREFIX, _continue__)
#define STOUT_FOREACH_ELEM   CAT(STOUT_FOREACH_PREFIX, _elem__)
#define STOUT_FOREACH_ONCE   CAT(STOUT_FOREACH_PREFIX, _once__)
#define STOUT_FOREACH_PREFIX   CAT(__foreach_, __LINE__)