From 9fa9edb24d762866c49755f71204194c5a075202 Mon Sep 17 00:00:00 2001 From: ado Date: Wed, 30 Mar 2022 20:11:55 +0200 Subject: [PATCH] add spp.hpp --- include/ss/extract.hpp | 1 - ssp.hpp | 2967 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2967 insertions(+), 1 deletion(-) create mode 100644 ssp.hpp diff --git a/include/ss/extract.hpp b/include/ss/extract.hpp index ae2d81c..760aca8 100644 --- a/include/ss/extract.hpp +++ b/include/ss/extract.hpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/ssp.hpp b/ssp.hpp new file mode 100644 index 0000000..b49906b --- /dev/null +++ b/ssp.hpp @@ -0,0 +1,2967 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define SSP_DISABLE_FAST_FLOAT + + +namespace ss { + +//////////////// +// tup merge/cat +//////////////// + +template +struct tup_cat; + +template +struct tup_cat, std::tuple> { + using type = std::tuple; +}; + +template +struct tup_cat> { + using type = std::tuple; +}; + +template +using tup_cat_t = typename tup_cat::type; + +//////////////// +// tup first/head +//////////////// + +template +struct left_of_impl; + +template +struct left_of_impl { + static_assert(N < 128, "recursion limit reached"); + static_assert(N != 0, "cannot take the whole tuple"); + using type = tup_cat_t::type>; +}; + +template +struct left_of_impl<0, T, Ts...> { + using type = std::tuple; +}; + +template +using left_of_t = typename left_of_impl::type; + +template +using first_t = typename left_of_impl::type; + +template +using head_t = typename left_of_impl<0, Ts...>::type; + +//////////////// +// tup tail/last +//////////////// + +template +struct right_of_impl; + +template +struct right_of_impl { + using type = typename right_of_impl::type; +}; + +template +struct right_of_impl<0, T, Ts...> { + using type = std::tuple; +}; + +template +using right_of_t = typename right_of_impl::type; + +template +using tail_t = typename right_of_impl<1, Ts...>::type; + +template +using last_t = typename right_of_impl::type; + +//////////////// +// apply trait +//////////////// + +template