29 #ifndef NANO_LIST_FUNCTIONS_HPP
30 #define NANO_LIST_FUNCTIONS_HPP
35 #include <type_traits>
48 template <
typename List1,
typename List2>
57 template <
typename Head1,
typename... Tail1,
typename Head2,
typename... Tail2>
79 template <
typename List1,
typename List2>
83 template <
typename Head1,
typename... Tail1,
typename Head2,
typename... Tail2>
107 template <
typename List1,
typename List2>
111 template <
typename Head1,
typename... Tail1,
typename Head2,
typename... Tail2>
129 template <
typename List1,
typename List2>
133 template <
typename Head1,
typename... Tail1,
typename Head2,
typename... Tail2>
159 template <
typename List,
typename Current = nano::
int_t<1>>
163 template <
typename Head,
typename... Tail,
typename Current>
168 std::is_same<typename Current::type, int>::value,
174 static constexpr
typename Current::type result =
multiplies<
list<Tail...>, updated_value>::result;
178 template <
typename Current>
181 static constexpr
typename Current::type result = Current::value;
197 template <
typename List ,
198 std::size_t Iteration ,
199 typename StartIndex ,
202 template <
typename...>
class Operation >
206 template <
typename Head ,
208 std::size_t Iteration ,
209 typename StartIndex ,
212 template <
typename...>
class Operation >
213 struct accumulate<
list<Head, Tail...>, Iteration, StartIndex, EndIndex, Value, Operation>
215 using temp_type =
typename std::conditional<Iteration >= StartIndex::value &&
216 Iteration <= EndIndex::value ,
218 typename Operation<Head, Value>::default_type
223 static constexpr
typename Value::type result =
228 template <
typename... Tail ,
229 std::size_t Iteration ,
230 typename StartIndex ,
233 template <
typename...>
class Operation >
234 struct accumulate<
list<Tail...>, Iteration, StartIndex, EndIndex, Value, Operation>
236 static constexpr
typename Value::type result = Value::value;
242 template <
typename List ,
243 std::size_t StartIndex = 0 ,
244 std::size_t EndIndex = std::numeric_limits<std::size_t>::max() ,
245 std::size_t StartValue = 1 ,
256 #endif // LIST_FUNCTIONS_HPP
Like std::accumulate, where the start and end indices, and the accumulation functor can be specified...
Definition: list_functions.hpp:203
Constructs a range of nano::int_t t types, which is essentially just a list of nano::int_t types...
Definition: containers.hpp:100
typename zip< is_found, indices, searched_lists, empty_list >::result result
Definition: list_functions.hpp:94
Multiplies two nano numeric types.
Definition: functions.hpp:110
For each element in the first list, the index of the element in the second list is searched for...
Definition: list_functions.hpp:49
Wrapper around int for static int types used by metaclass and metafunctions in nano.
Definition: numeric_types.hpp:63
Takes two lists, and zips the corresponding elements into a list of 2 elements if the function to det...
Definition: higher_order_functions.hpp:105
typename filter< type_not_present, list< Head1, Tail1...>, list< Head2, Tail2...>, empty_list >::result result
Definition: list_functions.hpp:116
typename std::conditional< Iteration >=StartIndex::value &&Iteration<=EndIndex::value, Head, typename Operation< Head, Value >::default_type >::type temp_type
Definition: list_functions.hpp:219
Definition: containers.hpp:34
typename range< 0, sizeof...(Tail1), 1 >::result indices
Definition: list_functions.hpp:137
Finds all elements of the first list which are not present in the second list, and returns a new list...
Definition: list_functions.hpp:108
Same as std::multiplies, but for a nano:list which can be computed at compile time - computes the pro...
Definition: list_functions.hpp:160
Header file for nano higher order functions. Higher order functions are functions which satisfy at...
Find the index of a specific type in the list (the index of the first occurrence). If the type is not found then the value 'parameter' will be -1.
Definition: list.hpp:96
Meta class that holds types, and allows functions to be applied to the elements of the list using the...
Definition: list.hpp:51
To check if a type in a list is not found. Where the find_type tries to find a type and get its index...
Definition: list.hpp:131
Takes a list and an evaluation function, which itself takes the list and a parameter to evaluate if e...
Definition: higher_order_functions.hpp:53
typename detail::search_lists< list< Head1, Tail1...>, list< Head2, Tail2...>>::result searched_lists
Definition: list_functions.hpp:91
typename range< 0, sizeof...(Tail1), 1 >::result indices
Definition: list_functions.hpp:87
typename detail::search_lists< list< Head1, Tail1...>, list< Head2, Tail2...>>::result search_results
Definition: list_functions.hpp:142
typename filter< first_not_present, indices, search_results, empty_list >::result result
Definition: list_functions.hpp:148
typename Operation< temp_type, Value >::type current_accumulation
Definition: list_functions.hpp:221
Finds the indices of the elements in the first list which are not present in the second list and retu...
Definition: list_functions.hpp:130
Wrapper around size_t for static size_t types used by metaclass and metafunctions in nano...
Definition: numeric_types.hpp:40
Finds all common elements in 2 lists and returns a zipped list of the result, where each zipped eleme...
Definition: list_functions.hpp:80
typename std::conditional< std::is_same< typename Current::type, int >::value, nano::int_t< Head::value *Current::value >, nano::size_t< Head::value *Current::value > >::type updated_value
Definition: list_functions.hpp:171