proxygen
Foreach.h File Reference
#include <folly/Portability.h>
#include <folly/Preprocessor.h>
#include <type_traits>
#include <folly/container/Foreach-inl.h>

Go to the source code of this file.

Classes

class  folly::detail::HasLess< T, U >
 
struct  folly::detail::HasLess< T, U >::BiggerThanChar
 

Namespaces

 folly
 —— Concurrent Priority Queue Implementation ——
 
 folly::for_each_detail
 
 folly::detail
 

Macros

#define _FE_ANON(x)   FB_CONCATENATE(FOR_EACH_, FB_CONCATENATE(x, __LINE__))
 
#define FOR_EACH(i, c)
 
#define FOR_EACH_R(i, c)
 
#define FOR_EACH_ENUMERATE(count, i, c)
 
#define FOR_EACH_KV(k, v, c)
 
#define FOR_EACH_RANGE(i, begin, end)
 
#define FOR_EACH_RANGE_R(i, begin, end)   for (auto i = (false ? (begin) : (end)); ::folly::detail::downTo(i, (begin));)
 

Enumerations

enum  folly::for_each_detail::LoopControl : bool { folly::for_each_detail::LoopControl::BREAK, folly::for_each_detail::LoopControl::CONTINUE }
 

Functions

template<typename Range , typename Func >
FOLLY_CPP14_CONSTEXPR Func folly::for_each (Range &&range, Func func)
 
template<typename Sequence , typename Index >
decltype(auto) FOLLY_CPP14_CONSTEXPR folly::fetch (Sequence &&sequence, Index &&index)
 
template<class T , class U >
std::enable_if< (std::is_arithmetic< T >::value &&std::is_arithmetic< U >::value)||(std::is_pointer< T >::value &&std::is_pointer< U >::value), bool >::type folly::detail::notThereYet (T &iter, const U &end)
 
template<class T , class U >
std::enable_if< !((std::is_arithmetic< T >::value &&std::is_arithmetic< U >::value)||(std::is_pointer< T >::value &&std::is_pointer< U >::value)), bool >::type folly::detail::notThereYet (T &iter, const U &end)
 
template<class T , class U >
std::enable_if< HasLess< U, T >::value, bool >::type folly::detail::downTo (T &iter, const U &begin)
 
template<class T , class U >
std::enable_if<!HasLess< U, T >::value, bool >::type folly::detail::downTo (T &iter, const U &begin)
 

Variables

constexpr auto folly::loop_break = for_each_detail::LoopControl::BREAK
 
constexpr auto folly::loop_continue = for_each_detail::LoopControl::CONTINUE
 

Macro Definition Documentation

#define _FE_ANON (   x)    FB_CONCATENATE(FOR_EACH_, FB_CONCATENATE(x, __LINE__))

Everything below is deprecated.

Definition at line 134 of file Foreach.h.

#define FOR_EACH (   i,
  c 
)
Value:
if (bool _FE_ANON(s1_) = false) { \
} else \
for (auto&& _FE_ANON(s2_) = (c); !_FE_ANON(s1_); _FE_ANON(s1_) = true) \
for (auto i = _FE_ANON(s2_).begin(); i != _FE_ANON(s2_).end(); ++i)
#define _FE_ANON(x)
Definition: Foreach.h:134
char c

Definition at line 143 of file Foreach.h.

Referenced by BENCHMARK(), randomBinaryString(), randomString(), TEST(), and TESTFUN().

#define FOR_EACH_ENUMERATE (   count,
  i,
  c 
)
Value:
if (bool _FE_ANON(s1_) = false) { \
} else \
for (auto&& FOR_EACH_state2 = (c); !_FE_ANON(s1_); _FE_ANON(s1_) = true) \
if (size_t _FE_ANON(n1_) = 0) { \
} else if (const size_t& count = _FE_ANON(n1_)) { \
} else \
for (auto i = FOR_EACH_state2.begin(); i != FOR_EACH_state2.end(); \
++_FE_ANON(n1_), ++i)
#define _FE_ANON(x)
Definition: Foreach.h:134
int * count
char c

Definition at line 170 of file Foreach.h.

Referenced by proxygen::RendezvousHash::getNthByWeightedHash(), proxygen::stringToMethod(), and TEST().

#define FOR_EACH_KV (   k,
  v,
  c 
)
Value:
if (unsigned int _FE_ANON(s1_) = 0) { \
} else \
for (auto&& _FE_ANON(s2_) = (c); !_FE_ANON(s1_); _FE_ANON(s1_) = 1) \
for (auto _FE_ANON(s3_) = _FE_ANON(s2_).begin(); \
_FE_ANON(s3_) != _FE_ANON(s2_).end(); \
_FE_ANON(s1_) == 2 ? ((_FE_ANON(s1_) = 0), ++_FE_ANON(s3_)) \
: (_FE_ANON(s3_) = _FE_ANON(s2_).end())) \
for (auto& k = _FE_ANON(s3_)->first; !_FE_ANON(s1_); ++_FE_ANON(s1_)) \
for (auto& v = _FE_ANON(s3_)->second; !_FE_ANON(s1_); ++_FE_ANON(s1_))
#define _FE_ANON(x)
Definition: Foreach.h:134
char c
KeyT k
constexpr detail::First first
Definition: Base-inl.h:2553

If you just want the keys, please use this (ranges-v3) construct:

for (auto&& element : collection | view::keys)

If you just want the values, please use this (ranges-v3) construct:

for (auto&& element : collection | view::values)

If you need to see both, use:

for (auto&& element : collection) { auto const& key = element.first; auto& value = element.second; ...... }

Definition at line 197 of file Foreach.h.

Referenced by BENCHMARK(), and TEST().

#define FOR_EACH_R (   i,
  c 
)
Value:
if (bool _FE_ANON(s1_) = false) { \
} else \
for (auto&& _FE_ANON(s2_) = (c); !_FE_ANON(s1_); _FE_ANON(s1_) = true) \
for (auto i = _FE_ANON(s2_).rbegin(); i != _FE_ANON(s2_).rend(); ++i)
#define _FE_ANON(x)
Definition: Foreach.h:134
char c

Definition at line 156 of file Foreach.h.

Referenced by TEST().

#define FOR_EACH_RANGE (   i,
  begin,
  end 
)
Value:
for (auto i = (true ? (begin) : (end)); \
++i)
auto begin(TestAdlIterable &instance)
Definition: ForeachTest.cpp:56
auto end(TestAdlIterable &instance)
Definition: ForeachTest.cpp:62
std::enable_if< !((std::is_arithmetic< T >::value &&std::is_arithmetic< U >::value)||(std::is_pointer< T >::value &&std::is_pointer< U >::value)), bool >::type notThereYet(T &iter, const U &end)
Definition: Foreach.h:276

Definition at line 313 of file Foreach.h.

Referenced by addValue(), assignmentFill(), assignmentOp(), folly::AtomicHashMap< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::AtomicHashMap(), BENCHMARK(), BENCHMARK_MULTI(), BENCHMARK_RELATIVE(), BENCHMARK_RELATIVE_MULTI(), folly::AtomicHashMap< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::capacity(), clause11_21_4_2_j(), clause11_21_4_2_k(), clause11_21_4_6_1(), folly::AtomicHashArray< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::clear(), folly::AtomicHashMap< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::clear(), clibAtoiMeasure(), copyCtor(), countHits(), folly::AtomicHashArray< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::create(), ctorFromArray(), ctorFromChar(), ctorFromTwoPointers(), defaultCtor(), folly::AtomicHashArray< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::destroy(), equality(), folly::AtomicHashMap< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::erase(), fillCtor(), findFirstOfRange(), folly::AtomicHashMap< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::findInternal(), findSuccessful(), findUnsuccessful(), follyAtoiMeasure(), getline(), proxygen::HTTPServer::getSockets(), handwrittenAtoiMeasure(), i64ToStringFollyMeasureNeg(), i64ToStringFollyMeasurePos(), insertFront(), folly::AtomicHashMap< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::insertInternal(), lexicalCastMeasure(), folly::threadlocal_detail::StaticMetaBase::onThreadExit(), StringIdenticalToBM< String >::operator()(), StringVariadicToBM< String >::operator()(), push_back(), pushBack(), ShardedAtomicInt::readFast(), replace(), reserve(), resize(), folly::runBenchmarks(), short_append(), folly::AtomicHashMap< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::size(), sizeCtor(), folly::AtomicHashMap< KeyT, ValueT, HashFcn, EqualFcn, Allocator, ProbeFcn, KeyConvertFcn >::spaceRemaining(), proxygen::HTTPServer::start(), StringUnsplit_Gen(), TEST(), TESTFUN(), testString2Integral(), u2aAppendClassicBM(), u2aAppendFollyBM(), u64ToAsciiClassicBM(), u64ToAsciiFollyBM(), u64ToAsciiTableBM(), u64ToStringClibMeasure(), u64ToStringFollyMeasure(), and folly::AtomicHashMap< int64_t, int64_t >::~AtomicHashMap().

#define FOR_EACH_RANGE_R (   i,
  begin,
  end 
)    for (auto i = (false ? (begin) : (end)); ::folly::detail::downTo(i, (begin));)

Definition at line 324 of file Foreach.h.

Referenced by BENCHMARK(), and TEST().