33 template <
typename... Args,
typename UnaryPredicate, std::size_t... Idx >
34 [[nodiscard]] constexpr std::size_t
35 find_if_impl( std::tuple< Args... >
const& t, UnaryPredicate&&
f, std::index_sequence< Idx... > )
37 std::size_t
res =
sizeof...( Args );
38 auto ff = [&](
auto const& item, std::size_t
const i ) {
46 ( ff( std::get< Idx >( t ), Idx ) || ... );
57 [[nodiscard]] std::array< T, N >
61 auto iter = cont.begin();
62 auto process = [&]( auto ) {
63 if constexpr ( std::is_reference_v< Container > )
66 return f( std::move( *iter++ ) );
72 return std::array< T, N >{ process( Is )... };
85 std::integer_sequence< std::size_t, Is... > )
87 auto process = [&cont, &
f]< std::size_t i >() {
88 return f( std::get< i >( std::forward< Container >( cont ) ) );
92 return std::array< T, N > { process.template operator()< Is >()... };
98 template < with_push_back T >
103 res.push_back( std::move( val ) );
107 template <
typename T >
109 struct map_f_collector< T >
113 res.insert( std::move( val ) );
117 template <
typename T, std::
size_t N >
124 res[i] = std::move( val );
129 template <
typename T >
134 template < std::
size_t I,
typename T >
137 constexpr std::size_t first_size = std::tuple_size_v< std::decay_t< T > >;
138 if constexpr ( I >= first_size )
144 #define EMLABCPP_INDEX_MAX 32
145 #define EMLABCPP_INDEX_EXPAND( F ) \
179 #define EMLABCPP_INDEX_SWITCH_CASE( x ) \
181 if constexpr ( x < N ) \
182 return std::forward< F >( f ).template operator()< Off + x >();
185 template < std::
size_t Off, std::
size_t N,
typename F >
200 #define EMLABCPP_INDEX_SEQ( x ) \
201 if constexpr ( x < N ) \
202 f.template operator()< Off + x >();
205 template < std::
size_t Off, std::
size_t N,
typename F >
213 #define EMLABCPP_INDEX_UNTIL( x ) \
214 if constexpr ( x < N ) \
215 if ( f.template operator()< Off + x >() ) \
219 template < std::
size_t Off, std::
size_t N,
typename F >
225 std::forward< F >(
f ) );
#define EMLABCPP_INDEX_MAX
Definition: impl.h:144
#define EMLABCPP_INDEX_EXPAND(F)
Definition: impl.h:145
#define EMLABCPP_INDEX_SEQ(x)
Definition: impl.h:200
#define EMLABCPP_INDEX_UNTIL(x)
Definition: impl.h:213
#define EMLABCPP_INDEX_SWITCH_CASE(x)
Definition: impl.h:179
MIT License.
Definition: impl.h:31
constexpr decltype(auto) index_switch(std::size_t i, F &&f)
Executes f<i> if provided i matches.
Definition: impl.h:186
constexpr auto get_ith_item_from_arrays(T &arr, auto &... arrays)
Definition: impl.h:135
constexpr std::size_t find_if_impl(std::tuple< Args... > const &t, UnaryPredicate &&f, std::index_sequence< Idx... >)
Definition: impl.h:35
constexpr void index_seq(F &&f)
Executes f<i> for i going from Off to N.
Definition: impl.h:206
std::array< T, N > map_f_to_a_impl(Container &&cont, UnaryCallable &&f, std::integer_sequence< std::size_t, Is... >)
Definition: impl.h:58
requires(!range_container< Container >) std
Definition: impl.h:81
concept map_f_collectable
Definition: impl.h:130
constexpr bool index_until(F &&f)
Executes f<i> until some is true.
Definition: impl.h:220
std::variant< int64_t, float, bool, string_buffer > value_type
Definition: base.h:51
concept range_container
so, std::ranges::range is meh because it expects return of begin() being input_output_iterator,...
Definition: concepts.h:78
T res
Definition: algorithm.h:505
UnaryCallable
Definition: types.h:54
concept gettable_container
Definition: concepts.h:71
UnaryCallable && f
Definition: algorithm.h:161
N
Definition: static_storage.h:97
void collect(T &res, typename T::value_type val) const
Definition: impl.h:101
void collect(std::array< T, N > &res, T val)
Definition: impl.h:122