proxygen
|
Namespaces | |
adl | |
Classes | |
struct | BeginAddTag |
struct | IndexingTag |
struct | IsMemberGetFound |
struct | IsMemberGetFound< EnableIfMemberGetFound< T >, T > |
struct | IsRange |
struct | IsRange< EnableIfRange< T >, T > |
struct | IsTuple |
struct | IsTuple< EnableIfTuple< T >, T > |
struct | RangeTag |
struct | TupleTag |
Typedefs | |
template<typename T > | |
using | EnableIfMemberGetFound = void_t< decltype(std::declval< T >().template get< 0 >())> |
template<typename Type , typename T = typename std::decay<Type>::type> | |
using | EnableIfTuple = void_t< decltype(get_impl< 0 >(std::declval< T >())), decltype(std::tuple_size< T >::value)> |
template<typename Type , typename T = typename std::decay<Type>::type> | |
using | EnableIfRange = void_t< decltype(adl::adl_begin(std::declval< T >())), decltype(adl::adl_end(std::declval< T >()))> |
template<typename Sequence > | |
using | SequenceTag = std::conditional_t< IsRange< void, Sequence >::value, RangeTag, TupleTag > |
template<typename Func , typename Item , typename Iter > | |
using | ForEachImplTag = std::conditional_t< is_invocable< Func, Item, index_constant< 0 >, Iter >::value, index_constant< 3 >, std::conditional_t< is_invocable< Func, Item, index_constant< 0 >>::value, index_constant< 2 >, std::conditional_t< is_invocable< Func, Item >::value, index_constant< 1 >, void >>> |
Enumerations | |
enum | LoopControl : bool { LoopControl::BREAK, LoopControl::CONTINUE } |
Functions | |
template<std::size_t Index, typename Type , std::enable_if_t<!IsMemberGetFound< void, Type >::value, int > = 0> | |
auto | get_impl (Type &&instance) -> decltype(adl::adl_get< Index >(static_cast< Type && >(instance))) |
template<typename Func , typename... Args, std::enable_if_t< is_invocable_r< LoopControl, Func, Args... >::value, int > = 0> | |
LoopControl | invoke_returning_loop_control (Func &&f, Args &&...a) |
template<typename Sequence , typename Func > | |
void | for_each_range_impl (index_constant< 3 >, Sequence &&range, Func &func) |
template<typename Sequence , typename Func > | |
void | for_each_range_impl (index_constant< 2 >, Sequence &&range, Func &func) |
template<typename Sequence , typename Func > | |
void | for_each_range_impl (index_constant< 1 >, Sequence &&range, Func &func) |
template<typename Sequence , typename Func , std::size_t... Indices> | |
void | for_each_tuple_impl (index_sequence< Indices... >, Sequence &&seq, Func &func) |
template<typename Sequence , typename Func > | |
void | for_each_tuple_impl (index_constant< 2 >, Sequence &&seq, Func &func) |
template<typename Sequence , typename Func > | |
void | for_each_tuple_impl (index_constant< 1 >, Sequence &&seq, Func &func) |
template<typename Sequence , typename Func > | |
static void | for_each_impl (TupleTag, Sequence &&range, Func &func) |
template<typename Sequence , typename Func > | |
static void | for_each_impl (RangeTag, Sequence &&range, Func &func) |
template<typename Sequence , typename Index > | |
decltype(auto) | fetch_impl (IndexingTag, Sequence &&sequence, Index &&index) |
template<typename Sequence , typename Index > | |
decltype(auto) | fetch_impl (BeginAddTag, Sequence &&sequence, Index index) |
template<typename Sequence , typename Index > | |
decltype(auto) | fetch_impl (TupleTag, Sequence &&sequence, Index index) |
template<typename Sequence , typename Index > | |
decltype(auto) | fetch_impl (RangeTag, Sequence &&sequence, Index &&index) |
The user should return loop_break and loop_continue if they want to iterate in such a way that they can preemptively stop the loop and break out when certain conditions are met.
using folly::for_each_detail::EnableIfMemberGetFound = typedef void_t<decltype(std::declval<T>().template get<0>())> |
Enable if the tuple supports fetching via a member get<>()
Definition at line 69 of file Foreach-inl.h.
using folly::for_each_detail::EnableIfRange = typedef void_t< decltype(adl::adl_begin(std::declval<T>())), decltype(adl::adl_end(std::declval<T>()))> |
Check if the sequence is a range
Definition at line 115 of file Foreach-inl.h.
using folly::for_each_detail::EnableIfTuple = typedef void_t< decltype(get_impl<0>(std::declval<T>())), decltype(std::tuple_size<T>::value)> |
Check if the sequence is a tuple
Definition at line 103 of file Foreach-inl.h.
using folly::for_each_detail::ForEachImplTag = typedef std::conditional_t< is_invocable<Func, Item, index_constant<0>, Iter>::value, index_constant<3>, std::conditional_t< is_invocable<Func, Item, index_constant<0>>::value, index_constant<2>, std::conditional_t< is_invocable<Func, Item>::value, index_constant<1>, void>>> |
Definition at line 144 of file Foreach-inl.h.
using folly::for_each_detail::SequenceTag = typedef std::conditional_t<IsRange<void, Sequence>::value, RangeTag, TupleTag> |
Should ideally check if it is a tuple and if not return void, but msvc fails
Definition at line 129 of file Foreach-inl.h.
|
strong |
decltype(auto) folly::for_each_detail::fetch_impl | ( | IndexingTag | , |
Sequence && | sequence, | ||
Index && | index | ||
) |
Definition at line 286 of file Foreach-inl.h.
Referenced by folly::fetch(), and fetch_impl().
decltype(auto) folly::for_each_detail::fetch_impl | ( | BeginAddTag | , |
Sequence && | sequence, | ||
Index | index | ||
) |
Definition at line 290 of file Foreach-inl.h.
References folly::for_each_detail::adl::adl_begin().
decltype(auto) folly::for_each_detail::fetch_impl | ( | TupleTag | , |
Sequence && | sequence, | ||
Index | index | ||
) |
Definition at line 295 of file Foreach-inl.h.
decltype(auto) folly::for_each_detail::fetch_impl | ( | RangeTag | , |
Sequence && | sequence, | ||
Index && | index | ||
) |
Definition at line 299 of file Foreach-inl.h.
References folly::for_each_detail::adl::adl_begin(), fetch_impl(), and value.
|
static |
Top level handlers for the for_each loop, with one overload for tuples and one overload for ranges
This implies that if type is both a range and a tuple, it is treated as a range rather than as a tuple
Definition at line 270 of file Foreach-inl.h.
References for_each_tuple_impl(), folly::range(), type, and value.
|
static |
Definition at line 277 of file Foreach-inl.h.
References folly::for_each_detail::adl::adl_begin(), for_each_range_impl(), folly::range(), type, and value.
Referenced by folly::for_each().
void folly::for_each_detail::for_each_range_impl | ( | index_constant< 3 > | , |
Sequence && | range, | ||
Func & | func | ||
) |
Implementations for the runtime function
Definition at line 170 of file Foreach-inl.h.
References folly::for_each_detail::adl::adl_begin(), folly::for_each_detail::adl::adl_end(), folly::gen::first, invoke_returning_loop_control(), folly::loop_break, cpp.ast::next(), and folly::range().
Referenced by for_each_impl(), and for_each_range_impl().
void folly::for_each_detail::for_each_range_impl | ( | index_constant< 2 > | , |
Sequence && | range, | ||
Func & | func | ||
) |
Definition at line 183 of file Foreach-inl.h.
References for_each_range_impl(), and folly::range().
void folly::for_each_detail::for_each_range_impl | ( | index_constant< 1 > | , |
Sequence && | range, | ||
Func & | func | ||
) |
Definition at line 195 of file Foreach-inl.h.
References for_each_range_impl(), and folly::range().
void folly::for_each_detail::for_each_tuple_impl | ( | index_sequence< Indices... > | , |
Sequence && | seq, | ||
Func & | func | ||
) |
Handlers for iteration
Definition at line 209 of file Foreach-inl.h.
References testing::_, invoke_returning_loop_control(), folly::loop_continue, and folly::gen::seq().
Referenced by for_each_impl(), and for_each_tuple_impl().
void folly::for_each_detail::for_each_tuple_impl | ( | index_constant< 2 > | , |
Sequence && | seq, | ||
Func & | func | ||
) |
The two top level compile time loop iteration functions handle the dispatch based on the number of arguments the passed in function can be passed, if 2 arguments can be passed then the implementation dispatches work further to the implementation classes above. If not then an adaptor is constructed which is passed on to the 2 argument specialization, which then in turn forwards implementation to the implementation classes above
Definition at line 244 of file Foreach-inl.h.
References for_each_tuple_impl(), folly::gen::seq(), folly::size(), and type.
void folly::for_each_detail::for_each_tuple_impl | ( | index_constant< 1 > | , |
Sequence && | seq, | ||
Func & | func | ||
) |
Definition at line 252 of file Foreach-inl.h.
References for_each_tuple_impl(), and folly::gen::seq().
auto folly::for_each_detail::get_impl | ( | Type && | instance | ) | -> decltype(adl::adl_get<Index>(static_cast<Type&&>(instance))) |
A get that tries member get<> first and if that is not found tries ADL get<>. This mechanism is as found in the structured bindings proposal here 11.5.3. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf
Definition at line 84 of file Foreach-inl.h.
LoopControl folly::for_each_detail::invoke_returning_loop_control | ( | Func && | f, |
Args &&... | a | ||
) |
Definition at line 151 of file Foreach-inl.h.
References a, testing::Args(), f, folly::loop_continue, and folly::value().
Referenced by for_each_range_impl(), and for_each_tuple_impl().