#include #include #include #include #include "example.hpp" HIDE( /// [list1] using list = metal::list<>; // an empty list /// [list1] IS_SAME(metal::is_list, metal::true_); ) HIDE( /// [list2] using list = metal::list; /// [list2] IS_SAME(metal::is_list, metal::true_); ) HIDE( /// [not_a_list1] using not_a_list = std::tuple; // not a specialization of metal::list /// [not_a_list1] IS_SAME(metal::is_list, metal::false_); ) HIDE( /// [is_list] IS_SAME(metal::is_list, metal::false_); IS_SAME(metal::is_list>, metal::false_); IS_SAME(metal::is_list>, metal::true_); IS_SAME(metal::is_list>, metal::true_); IS_SAME(metal::is_list>>, metal::true_); /// [is_list] ) HIDE( /// [as_list] IS_SAME(metal::as_list>, metal::list); IS_SAME( metal::as_list>, metal::list> ); IS_SAME( metal::as_list>, metal::list ); /// [as_list] ) HIDE( /// [size] using l = metal::list; IS_SAME(metal::size, metal::number<6>); IS_SAME(metal::size>, metal::number<0>); /// [size] ) HIDE( /// [empty] using l = metal::list; IS_SAME(metal::empty, metal::false_); IS_SAME(metal::empty>, metal::true_); /// [empty] ) HIDE( /// [indices] using l = metal::list; IS_SAME( metal::indices, metal::list< metal::number<0>, metal::number<1>, metal::number<2>, metal::number<3>, metal::number<4>, metal::number<5> > ); /// [indices] ) HIDE( /// [at] using l = metal::list; IS_SAME(metal::at>, short); IS_SAME(metal::at>, int); IS_SAME(metal::at>, long); IS_SAME(metal::at>, float); IS_SAME(metal::at>, double); IS_SAME(metal::at>, void); /// [at] ) HIDE( /// [front] using l = metal::list; IS_SAME(metal::front, short); /// [front] ) HIDE( /// [back] using l = metal::list; IS_SAME(metal::back, void); /// [back] ) HIDE( /// [contains] using l = metal::list; IS_SAME(metal::contains, metal::true_); IS_SAME(metal::contains, metal::true_); IS_SAME(metal::contains, metal::true_); IS_SAME(metal::contains, metal::false_); /// [contains] ) HIDE( /// [count] using l = metal::list; IS_SAME(metal::count, metal::number<3>); IS_SAME(metal::count, metal::number<2>); IS_SAME(metal::count, metal::number<1>); IS_SAME(metal::count, metal::number<0>); /// [count] ) HIDE( /// [find] using l = metal::list; IS_SAME(metal::find, metal::number<0>); IS_SAME(metal::find, metal::number<2>); IS_SAME(metal::find, metal::number<4>); IS_SAME(metal::find, metal::number<6>); /// [find] ) HIDE( /// [copy] using l = metal::list; IS_SAME(metal::copy, metal::list); IS_SAME(metal::copy, metal::list); IS_SAME(metal::copy, metal::list); IS_SAME(metal::copy, metal::list<>); /// [copy] ) HIDE( /// [remove] using l = metal::list; IS_SAME(metal::remove, metal::list); IS_SAME(metal::remove, metal::list); IS_SAME(metal::remove, metal::list); IS_SAME(metal::remove, metal::list); /// [remove] ) HIDE( /// [replace] using l = metal::list; IS_SAME( metal::replace, metal::list ); IS_SAME( metal::replace, metal::list ); IS_SAME( metal::replace, metal::list ); /// [replace] ) HIDE( /// [all_of] using l = metal::list; IS_SAME(metal::all_of>, metal::true_); IS_SAME(metal::all_of>, metal::false_); IS_SAME(metal::all_of>, metal::false_); /// [all_of] ) HIDE( /// [any_of] using l = metal::list; IS_SAME(metal::any_of>, metal::true_); IS_SAME(metal::any_of>, metal::true_); IS_SAME(metal::any_of>, metal::false_); /// [any_of] ) HIDE( /// [none_of] using l = metal::list; IS_SAME(metal::none_of>, metal::false_); IS_SAME(metal::none_of>, metal::false_); IS_SAME(metal::none_of>, metal::true_); /// [none_of] ) HIDE( /// [count_if] using l = metal::list; IS_SAME(metal::count_if>, metal::number<6>); IS_SAME(metal::count_if>, metal::number<2>); IS_SAME(metal::count_if>, metal::number<0>); /// [count_if] ) HIDE( /// [find_if] using l = metal::list; IS_SAME(metal::find_if>, metal::number<0>); IS_SAME(metal::find_if>, metal::number<3>); IS_SAME(metal::find_if>, metal::number<6>); /// [find_if] ) HIDE( /// [partition] using l = metal::list; IS_SAME( metal::partition>, metal::pair, metal::list<>> ); IS_SAME( metal::partition>, metal::pair, metal::list> ); IS_SAME( metal::partition>, metal::pair, metal::list> ); /// [partition] ) HIDE( /// [copy_if] using l = metal::list; IS_SAME( metal::copy_if>, metal::list ); IS_SAME( metal::copy_if>, metal::list ); IS_SAME(metal::copy_if>, metal::list<>); /// [copy_if] ) HIDE( /// [remove_if] using l = metal::list; IS_SAME(metal::remove_if>, metal::list<>); IS_SAME( metal::remove_if>, metal::list ); IS_SAME( metal::remove_if>, metal::list ); /// [remove_if] ) HIDE( /// [replace_if] using l = metal::list; IS_SAME( metal::replace_if, char>, metal::list ); IS_SAME( metal::replace_if, char>, metal::list ); IS_SAME( metal::replace_if, char>, metal::list ); /// [replace_if] ) HIDE( /// [flatten] using character = metal::list; using integral = metal::list; using floating = metal::list; IS_SAME( metal::flatten>, metal::list< char, wchar_t, char16_t, char32_t, short, int, long, long long, float, double, long double > ); /// [flatten] ) HIDE( /// [join] using character = metal::list; using integral = metal::list; using floating = metal::list; IS_SAME( metal::join, metal::list< char, wchar_t, char16_t, char32_t, short, int, long, long long, float, double, long double > ); /// [join] ) HIDE( /// [splice] using l = metal::list; IS_SAME( metal::splice, metal::list>, metal::list ); /// [splice] ) HIDE( /// [insert] using l = metal::list; IS_SAME( metal::insert, unsigned>, metal::list ); /// [insert] ) HIDE( /// [append] using l = metal::list; IS_SAME( metal::append, metal::list ); /// [append] ) HIDE( /// [prepend] using l = metal::list; IS_SAME( metal::prepend, metal::list ); /// [prepend] ) HIDE( /// [iota] IS_SAME( metal::iota, metal::number<3>>, metal::list, metal::number<'b'>, metal::number<'c'>> ); IS_SAME( metal::iota, metal::number<3>, metal::number<-5>>, metal::list, metal::number<-3>, metal::number<-8>> ); IS_SAME( metal::iota, metal::number<-3>, metal::number<-5>>, metal::list, metal::number<7>, metal::number<12>> ); /// [iota] ) HIDE( /// [repeat] IS_SAME(metal::repeat>, metal::list<>); IS_SAME(metal::repeat>, metal::list); /// [repeat] ) HIDE( /// [slice] using l = metal::list; IS_SAME( metal::slice, metal::number<3>>, metal::list ); IS_SAME( metal::slice, metal::number<2>, metal::number<3>>, metal::list ); IS_SAME( metal::slice, metal::number<-3>, metal::number<2>>, metal::list ); /// [slice] ) HIDE( /// [range] using l = metal::list; IS_SAME( metal::range, metal::number<5>>, metal::list ); IS_SAME( metal::range, metal::number<2>>, metal::list ); /// [range] ) HIDE( /// [erase] using l = metal::list; IS_SAME( metal::erase, metal::number<5>>, metal::list ); IS_SAME( metal::erase, metal::number<2>>, metal::list ); /// [erase] ) HIDE( /// [drop] using l = metal::list; IS_SAME(metal::drop>, metal::list); /// [drop] ) HIDE( /// [take] using l = metal::list; IS_SAME(metal::take>, metal::list); /// [take] ) HIDE( /// [reverse] using l = metal::list; IS_SAME(metal::reverse, metal::list); /// [reverse] ) HIDE( /// [rotate] using l = metal::list; IS_SAME( metal::rotate>, metal::list ); IS_SAME( metal::rotate>, metal::list ); /// [rotate] ) HIDE( /// [sort] using l = metal::list; template // strict ordering using smaller = metal::number; IS_SAME( metal::sort>, // stable sorting metal::list ); template // partial ordering using not_bigger = metal::number; IS_SAME( metal::sort>, // non-stable sorting metal::list ); IS_SAME( metal::sort>, // use default ordering metal::sort, metal::lambda> ); /// [sort] ) HIDE( /// [cartesian] struct a; struct b; struct c; struct d; struct e; struct f; struct g; using x = metal::list; using y = metal::list; using z = metal::list; IS_SAME( metal::cartesian, metal::list< metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list > ); /// [cartesian] ) HIDE( /// [cascade] struct a; struct b; struct c; struct d; template struct f {}; template struct g {}; template struct h {}; using tree = metal::list< metal::list, metal::list>, metal::list, metal::list> >; IS_SAME( metal::cascade, metal::lambda, metal::lambda>, f, h>, g, h>> ); /// [cascade] ) HIDE( /// [combine] struct a; struct b; struct c; struct d; IS_SAME( metal::combine, metal::number<2>>, metal::list< metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list > ); /// [combine] ) HIDE( /// [powerset] struct a; struct b; struct c; struct d; IS_SAME( metal::powerset>, metal::list< metal::list<>, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list, metal::list > ); /// [powerset] ) #if !defined(METAL_WORKAROUND) HIDE( /// [transform] using a = metal::list; using b = metal::list; using c = metal::list; IS_SAME( metal::transform, a, b, c>, metal::list ); /// [transform] ) #endif HIDE( /// [transpose] using l = metal::list< metal::list, metal::list, metal::list >; IS_SAME( metal::transpose, metal::list< metal::list, metal::list, metal::list, metal::list > ); /// [transpose] ) #if !defined(METAL_WORKAROUND) HIDE( /// [accumulate] template using add_extent = val[num::value]; using ext = metal::numbers<3, 5, 2>; IS_SAME(metal::accumulate, char, ext>, char[2][5][3]); using a = metal::list; using b = metal::list; using c = metal::list; IS_SAME( metal::accumulate, metal::list<>, a, b, c>, metal::list< int, char, float, int&, char&, float&, int*, char*, float*, int[], char[], float[] > ); /// [accumulate] ) #endif