◆ accumulate
| using metal::accumulate = typedef detail::call< if_<same<size<seqs>...>, detail::_accumulate<lbd> >::template type, state, seqs...> |
#include <metal/list/accumulate.hpp>
Description
Computes the recursive invocation of a binary Lambda with the result of the previous invocation and each element of one or more Lists traversed in parallel from the beginning to the end.
Usage
For any Lambda lbd, Value val and Lists l_0, ..., l_n-1
- Precondition
- :
metal::size<l_0>{} == metal::size<>{}... == metal::size<l_n-1>{}
- Returns
- : Value
- Semantics:
- Equivalent to whereusing result =lbd(... lbd(lbd(val, l[0]...), l[1]...), ..., l[m-1]...)
l[N]...stands forl_0[N], ...[N], l_n-1[N]andlbd(x, y)stands formetal::invoke<lbd, x, y>.
Example
See Also
◆ all_of
| using metal::all_of = typedef metal::apply<metal::lambda<metal::and_>, metal::transform<lbd, seq> > |
#include <metal/list/all_of.hpp>
Description
Checks whether a predicate holds for all elements of a List.
Usage
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : Number
- Semantics:
- If
metal::invoke<lbd, l[i]>{} != falsefor alll[i]contained inl, thenotherwiseusing result = metal::true_;using result = metal::false_;
Example
See Also
◆ any_of
| using metal::any_of = typedef metal::apply<metal::lambda<metal::or_>, metal::transform<lbd, seq> > |
#include <metal/list/any_of.hpp>
Description
Checks whether a predicate holds for at least some element of a List.
Usage
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : Number
- Semantics:
- If
metal::invoke<lbd, l[i]>{} != falsefor at least somel[i]contained inl, thenotherwiseusing result = metal::true_;using result = metal::false_;
Example
See Also
◆ append
| using metal::append = typedef metal::join<seq, metal::list<vals...> > |
◆ as_list
| using metal::as_list = typedef typename detail::_as_list<val>::type |
#include <metal/list/list.hpp>
Description
Given any Value that is a specialization of a template class or union whose template parameters are all themselves Values, constructs a List that contains all those Values.
Usage
For any Value val
- Returns
- : List
Example
See Also
◆ at
| using metal::at = typedef detail::call<detail::_at<seq>::template type, num> |
#include <metal/list/at.hpp>
Description
Retrieves an element of a List at an arbitrary position.
Usage
- Precondition
- :
metal::number<0>{} ≤ num{} < metal::size<l>{}
- Returns
- : Value
- Semantics:
- If
lcontains elementsl[0], ..., l[i], ..., l[m-1]andnum{} == i, thenusing result = l[i];
Example
See Also
◆ back
| using metal::back = typedef metal::at<seq, metal::dec<metal::size<seq> >> |
#include <metal/list/back.hpp>
Description
Retrieves the last element of a List.
Usage
For any List l
- Returns
- : Value
- Semantics:
- If
lcontains elementsl[0], ..., l[m-1], thenusing result = l[m-1];
Example
See Also
◆ cartesian
| using metal::cartesian = typedef fold_left<lambda<detail::product>, list<list<> >, seqs...> |
#include <metal/list/cartesian.hpp>
Description
Computes the cartesian product of Lists.
Usage
For any Lists l_0, ..., l_n-1
- Returns
- : List
- Semantics:
- Equivalent to where each
xinx_0, ..., x_n-1varies independently from0ton-1.
Example
See Also
◆ cascade
| using metal::cascade = typedef apply<fold_right<lambda<detail::cascader>, lbds...>, seq> |
#include <metal/list/cascade.hpp>
Description
Recursively applies Lambdas to nested Lists of Lists.
Usage
For any List l and Lambdas lbd_0, ..., lbd_n-1, where n > 0,
- Returns
- : Value
- Semantics:
- If
n == 1, thenotherwise, ifusing result = metal::apply<lbd_0, l>;lcontains elementsl[0], ..., l[m-1], thenusing result = metal::invoke<lbd_0,metal::cascade<l[0], lbd_1, ..., lbd_n-1>>,metal::cascade<l[1], lbd_1, ..., lbd_n-1>>,...,metal::cascade<l[m-1], lbd_1, ..., lbd_n-1>>>;
Example
See Also
◆ combine
| using metal::combine = typedef metal::apply< metal::lambda<metal::cartesian>, metal::repeat<metal::if_<metal::is_list<seq>, seq>, num> > |
#include <metal/list/combine.hpp>
Description
Computes all possible combinations (with repetition) from the elements in a List.
Usage
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[m-1]andnumholds the constantn, then where eachxinx_0, ..., x_n-1varies independently from0tom-1.
Example
See Also
◆ contains
| using metal::contains = typedef metal::any_of<seq, metal::partial<metal::lambda<metal::same>, val> > |
#include <metal/list/contains.hpp>
Description
Checks whether a Value is contained in a List.
Usage
- Returns
- : Number
- Semantics:
- If
valis contained inl, thenotherwiseusing result = metal::true_;using result = metal::false_;
Example
See Also
◆ copy
| using metal::copy = typedef metal::copy_if<seq, metal::partial<metal::lambda<metal::same>, val> > |
#include <metal/list/copy.hpp>
Description
Removes all elements from a List except for those that are the same as some Value.
Usage
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<...>;
resultcontains all and only the occurrences ofvalinl.
Example
See Also
◆ copy_if
| using metal::copy_if = typedef metal::remove_if<seq, metal::bind<metal::lambda<metal::not_>, lbd> > |
#include <metal/list/copy_if.hpp>
Description
Removes all elements from a List except for those that satisfy a predicate.
Usage
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<...>;
resultcontains all and only the elementsl[i]inlfor whichmetal::invoke<lbd, l[i]>{} != false.
Example
See Also
- See also
- list, copy, remove_if, replace_if
◆ count
| using metal::count = typedef metal::count_if<seq, metal::partial<metal::lambda<metal::same>, val> > |
#include <metal/list/count.hpp>
Description
Counts the occurrences of a Value in a List.
Usage
- Returns
- : Number
- Semantics:
- Equivalent to whereusing result = metal::number<n>;
nis the number of occurrences ofvalinl.
Example
See Also
◆ count_if
| using metal::count_if = typedef metal::apply<metal::lambda<metal::add>, metal::transform<lbd, seq> > |
#include <metal/list/count_if.hpp>
Description
Counts the elements in a List that satisfy a predicate.
Usage
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : Number
- Semantics:
- Equivalent to whereusing result = metal::number<n>;
nis the number of occurrences of somel[i]inl, such thatmetal::invoke<lbd, l[i]>{} != false.
Example
See Also
◆ drop
| using metal::drop = typedef metal::range<seq, n, metal::size<seq> > |
#include <metal/list/drop.hpp>
Description
Removes all elements from the beginning up to an arbitrary index of a List.
Usage
- Precondition
- :
metal::number<0>{} ≤ num{} ≤ metal::size<l>{}
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[i], ..., l[m-1]andnum{} == i, thenusing result = metal::list<l[i], ..., l[m-1]>;
Example
See Also
◆ empty
| using metal::empty = typedef metal::not_<metal::size<seq> > |
#include <metal/list/empty.hpp>
Description
Checks whether a List has no elements.
Usage
For any List l
- Returns
- : Number
- Semantics:
- If
lcontains at least one element, thenotherwiseusing result = metal::false_;using result = metal::true_;
Example
See Also
◆ erase
| using metal::erase = typedef metal::join< metal::take<seq, metal::min<beg, end> >, metal::drop<seq, metal::max<beg, end> >> |
#include <metal/list/erase.hpp>
Description
Removes all elements between two arbitrary indices of a List.
Usage
For any List l and Numbers beg and end
- Precondition
- :
metal::number<0>{} ≤ beg{} ≤ metal::size<l>{}andmetal::number<0>{} ≤ end{} ≤ metal::size<l>{}
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[i], ..., l[j], ..., l[m-1]and eitherbeg{} == iandend{} == jorbeg{} == jandend{} == i, then
Example
See Also
◆ find
| using metal::find = typedef metal::find_if<seq, metal::partial<metal::lambda<metal::same>, val> > |
#include <metal/list/find.hpp>
Description
Returns the index of the first occurrence of a Value in a List.
Usage
- Returns
- : Number
- Semantics:
- Equivalent to whereusing result = metal::number<i>;
iis index of the first occurrence ofvalinl, otherwiseusing result = metal::size<l>;
Example
See Also
◆ find_if
| using metal::find_if = typedef typename detail::_find_if<transform<lbd, seq> >::type |
#include <metal/list/find_if.hpp>
Description
Returns the index of the first element of a List that satisfy a predicate.
Usage
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : Number
- Semantics:
- Equivalent to whereusing result = metal::number<i>;
iis such thatl[i]is the first element inlfor whichmetal::invoke<lbd, l[i]>{} != false, otherwiseusing result = metal::size<l>;
Example
See Also
◆ flatten
| using metal::flatten = typedef metal::apply<metal::lambda<metal::join>, seq> |
#include <metal/list/flatten.hpp>
Description
Collapses a List of Lists into a flat List that contains all the elements of the inner Lists preserving their order.
Usage
For any List l
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[m-1], thenwhereusing result = metal::list<l[0][:], ...[:], l[n-1][:]>;l[:]stands for the expansion of all elements contained inl.
Example
See Also
◆ front
| using metal::front = typedef metal::at<seq, metal::number<0> > |
#include <metal/list/front.hpp>
Description
Retrieves the first element of a List.
Usage
For any List l
- Returns
- : Value
- Semantics:
- If
lcontains elementsl[0], ..., l[m-1], thenusing result = l[0];
Example
See Also
◆ indices
| using metal::indices = typedef metal::iota<metal::number<0>, metal::size<seq> > |
#include <metal/list/indices.hpp>
Description
Replaces each element of a List by its corresponding index.
Usage
For any List l
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[m-1], then
Example
See Also
◆ insert
| using metal::insert = typedef metal::splice<seq, num, metal::list<vals...> > |
#include <metal/list/insert.hpp>
Description
Inserts a Value in a List at an arbitrary position.
Usage
For any List l, Number num and Values val_0, ..., val_n-1
- Precondition
- :
metal::number<0>{} ≤ num{} ≤ metal::size<l>{}
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[i], ..., l[m-1]andnum{} == i, then
Example
See Also
◆ iota
| using metal::iota = typedef typename detail::_iota<start, size, stride>::type |
#include <metal/list/iota.hpp>
Description
Generates a sequence of Numbers.
Usage
For any Numbers st, sz and sd
- Returns
- : List
- Semantics:
- If
szis positive, then otherwise, ifszis negative, then otherwiseusing result = metal::numbers<>;
Example
See Also
◆ is_list
| using metal::is_list = typedef typename detail::_is_list<val>::type |
#include <metal/list/list.hpp>
Description
Checks whether some Value is a List.
Usage
For any Value val
- Returns
- : Number
- Semantics:
- If
valis a List, thenotherwiseusing result = metal::true_;using result = metal::false_;
Example
See Also
◆ join
| using metal::join = typedef detail::call<detail::joiner<sizeof...(seqs)>::template type, seqs...> |
#include <metal/list/join.hpp>
Description
Concatenates Lists.
Usage
For any Lists l_0, ..., l_n-1
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<l_0[:], ...[:], l_n-1[:]>;
l[:]stands for the expansion of all elements contained inl.
Example
See Also
◆ list
| using metal::list = typedef { } |
◆ none_of
| using metal::none_of = typedef metal::not_<metal::any_of<seq, lbd> > |
#include <metal/list/none_of.hpp>
Description
Checks whether a predicate does not hold for any element of a List.
Usage
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : Number
- Semantics:
- If
metal::invoke<lbd, l[i]>{} == falsefor alll[i]contained inl, thenotherwiseusing result = metal::true_;using result = metal::false_;
Example
See Also
◆ partition
| using metal::partition = typedef detail::call<detail::_partition<lbd>::template type, seq> |
#include <metal/list/partition.hpp>
Description
Splits a List in two according to a predicate.
Usage
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : Pair
- Semantics:
- Equivalent to whereusing result = metal::pair<l_1, l_2>;
l_1contains all and only the elementsl[i]inlfor whichmetal::invoke<lbd, l[i]>{} != falseandl_2contains the remaining elements.
Example
See Also
◆ powerset
| using metal::powerset = typedef accumulate<lambda<detail::power>, list<list<> >, metal::reverse<seq> > |
#include <metal/list/powerset.hpp>
Description
Computes the powerset of a List.
Usage
For any List l
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[m-1], thenwhere the notationusing result = metal::list<metal::list<l[2^m]>...>;l[2^m]stands for the expansion of all elements inl, whose indices correspond to 1-bits of the number2^mwritten in binary base andmetal::list<l[2^m]>...stands for the expansion for all numbers in0...2^m.
Example
See Also
◆ prepend
| using metal::prepend = typedef metal::join<metal::list<vals...>, seq> |
◆ range
| using metal::range = typedef detail::range< seq, if_<not_<or_<greater<number<0>, beg>, greater<beg, size<seq> >> >, beg>, if_<not_<or_<greater<number<0>, end>, greater<end, size<seq> >> >, end> > |
#include <metal/list/range.hpp>
Description
Returns a contiguous subsequence of a List.
Usage
For any List l and Numbers beg and end
- Precondition
- :
metal::number<0>{} ≤ beg{} ≤ metal::size<l>{}andmetal::number<0>{} ≤ end{} ≤ metal::size<l>{}
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[i], ..., l[j], ..., l[m-1],beg{} == iandend{} == j, thenotherwise, ifusing result = metal::list<l[i], ..., l[j-1]>;beg{} == jandend{} == i, thenusing result = metal::list<l[j-1], ..., l[i]>;
Example
See Also
◆ remove
| using metal::remove = typedef metal::remove_if<seq, metal::partial<metal::lambda<metal::same>, val> > |
#include <metal/list/remove.hpp>
Description
Removes all elements from a List that are the same as some Value.
Usage
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<...>;
resultcontains all and only the elements inlwhich are distinct fromval.
Example
See Also
◆ remove_if
| using metal::remove_if = typedef metal::replace_if<seq, lbd> |
#include <metal/list/remove_if.hpp>
Description
Removes all elements from a List that satisfy a predicate.
Usage
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<...>;
resultcontains all and only the elementsl[i]inlfor whichmetal::invoke<lbd, l[i]>{} == false.
Example
See Also
- See also
- list, remove, copy_if, replace_if
◆ repeat
| using metal::repeat = typedef metal::transform< metal::always<val>, metal::iota<metal::number<0>, num, metal::number<0> >> |
#include <metal/list/repeat.hpp>
Description
Returns a List that contains a Number of copies of the same Value.
Usage
For any Value val and Number num
- Returns
- : List
- Semantics:
- If
numholds the constantn, thenwhereusing result = metal::list<val_0, ..., val_n-1>;val_0, ..., val_n-1are all identical toval.
Example
See Also
◆ replace
| using metal::replace = typedef metal::replace_if<seq, metal::partial<metal::lambda<metal::same>, val>, vals...> |
#include <metal/list/replace.hpp>
Description
Replaces every occurrence of a Value in a List by another Value.
Usage
For any List l and Values val and val_0, ..., val_n-1
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<...>;
resultcontains all and only the elements inl, except that every occurrence ofvalhas been replaced byval_0, ..., val_n-1.
Example
See Also
- See also
- list, replace_if, copy, remove
◆ replace_if
| using metal::replace_if = typedef typename detail::_replace_if<seq, transform<lbd, seq>, vals...>::type |
#include <metal/list/replace_if.hpp>
Description
Replaces every element in a List that satisfies a predicate by some Value.
Usage
For any List l, Lambda lbd and Values val_0, ..., val_n-1
- Precondition
- : For any element
l[i]contained inl,metal::invoke<lbd, l[i]>returns a Number
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<...>;
resultcontains all and only the elements inl, except that every elementl[i]for whichmetal::invoke<lbd, l[i]>{} != falsehas been replaced byval_0, ..., val_n-1.
Example
See Also
◆ reverse
| using metal::reverse = typedef metal::range<seq, metal::size<seq>, metal::number<0> > |
#include <metal/list/reverse.hpp>
Description
Reverses the order of the elements of a List.
Usage
For any List l
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[m-1], thenusing result = metal::list<l[m-1], ..., l[0]>;
Example
See Also
◆ rotate
| using metal::rotate = typedef typename detail::_rotate<seq, num>::type |
#include <metal/list/rotate.hpp>
Description
Rotates the elements of a List around a pivot.
Usage
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[i-1], l[i], ..., l[m-1]andnum{} % m == i, then
Example
See Also
◆ size
| using metal::size = typedef typename detail::_size<seq>::type |
#include <metal/list/size.hpp>
Description
Returns the number of elements in a List.
Usage
For any List l
- Returns
- : Number
- Semantics:
- If
lcontains elementsl[0], ..., l[m-1], thenusing result = metal::number<m>;
Example
See Also
◆ slice
| using metal::slice = typedef metal::transform< metal::partial<metal::lambda<metal::at>, metal::if_<metal::is_list<seq>, seq> >, metal::iota<start, size, stride> > |
#include <metal/list/slice.hpp>
Description
Returns a subset of elements in a List picked at regular intervals in a range.
Usage
For any List l and Numbers st, sz and sd
- Precondition
- :
metal::number<0>{} ≤ n{} ≤ metal::size<l>{}for allninmetal::iota<st, sz, sd>
- Returns
- : List
- Semantics:
- If
metal::iota<st, sz, sd>contains Numbersnum_0, ..., num_n-1, thenusing result = metal::list<l[num_0], ..., l[num_n-1]>;
Example
See Also
◆ sort
| using metal::sort = typedef detail::call< detail::_sort<lbd>::template type, metal::if_<metal::is_list<seq>, seq> > |
#include <metal/list/sort.hpp>
Description
Sorts the elements of a List according to an ordering relation.
Usage
- Precondition
- : For any two Values
val_iandval_jcontained inlmetal::invoke<lbd, val_i, val_j>returns a Number
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<val_0, ..., val_m-1>;
val_0, ..., val_m-1is a permutation of the elements inlsuch thatmetal::invoke<lbd, val_i, val_i+1>{} != falsefor alliin[0, m-2].
lbd may be omitted, in which case it defaults to metal::lambda<metal::less>.Example
See Also
◆ splice
| using metal::splice = typedef metal::join<metal::take<seq, num>, other, metal::drop<seq, num> > |
#include <metal/list/splice.hpp>
Description
Splices one List into another at an arbitrary position.
Usage
For any Lists l_1 and l_2 and Number num
- Precondition
- :
metal::number<0>{} ≤ num{} ≤ metal::size<l_1>{}
- Returns
- : List
- Semantics:
- If
l_1contains elementsl_1[0], ..., l_1[i], ..., l_1[m-1],l_2contains elementsl_2[0], ..., l_2[n-1]andnum{} == i, then
Example
See Also
◆ take
| using metal::take = typedef metal::range<seq, metal::number<0>, n> |
#include <metal/list/take.hpp>
Description
Removes all elements from the end down to an arbitrary index of a List.
Usage
- Precondition
- :
metal::number<0>{} ≤ num{} ≤ metal::size<l>{}
- Returns
- : List
- Semantics:
- If
lcontains elementsl[0], ..., l[i], ..., l[m-1]andnum{} == i, thenusing result = metal::list<l[0], ..., l[i-1]>;
Example
See Also
◆ transform
| using metal::transform = typedef detail::call<if_<same<size<seqs>...>, detail::_transform<lbd> >::template type, seqs...> |
#include <metal/list/transform.hpp>
Description
Transforms one or more Lists into a new List through an arbitrary n-ary Lambda.
Usage
For any Lambda lbd and Lists l_0, ..., l_n-1
- Precondition
- :
metal::size<l_0>{} == metal::size<>{}... == metal::size<l_n-1>{}
- Returns
- : List
- Semantics:
- Equivalent to whereusing result = metal::list<metal::invoke<lbd, l[0]...>,metal::invoke<lbd, l[1]...>,...,metal::invoke<lbd, l[m-1]...>,>;
l[N]...stands forl_0[N], ...[N], l_n-1[N].
Example
See Also
- See also
- list, accumulate
◆ transpose
| using metal::transpose = typedef metal::apply< metal::partial<metal::lambda<metal::transform>, metal::lambda<metal::list> >, seq> |
#include <metal/list/transpose.hpp>
Description
Usage
For any List l
- Precondition
- : If
lcontains elementsl[0], ..., l[m-1],metal::size<l[0]>{} == metal::size<>{}... == metal::size<l[n-1]>{}
- Returns
- : List
- Semantics:
- Equivalent to using result = metal::list<metal::list<l[0][0], ...[0], l[m-1][0]>,...,metal::list<l[0][n-1], ...[n-1], l[m-1][n-1]>>;