std::tuple extensions
BBM heavily relies on std::tuple, and for your convenience some additional
extensions to the stl library are included:
Create a tuple from other types that support std::get:
Get a subset of a tuple:
Handling creating tuples to references, and removing references:
-
template<typename ...ARGS>
inline constexpr auto bbm::make_ref_tuple(ARGS&&... args) Make a tuple of references.
Returns std::tuple<ARGS…>, and therefore this method differs from:
std::make_tuple which returns a std::tuple<std::decay_t<ARGS>…>
std::forward_as_tuple which returns a std::tuple<ARGS&&…>
-
template<typename ...ARGS>
Flatten recursive tuples:
Adding and removing
constto tuple types:
BBM also includes a few As well as additional type-traits:
-
template<typename T>
using bbm::to_tuple_t = decltype(to_tuple(std::declval<T>())) type of converting a type that supports std::get to a tuple
-
template<typename ...Ts>
using bbm::tuple_cat_t = decltype(std::tuple_cat(std::declval<Ts>()...)) tuple_cat_t
Returns the type of std::tuple_cat
-
template<size_t START, size_t COUNT, typename TUP>
using bbm::subtuple_t = decltype(subtuple<START, COUNT>(std::declval<TUP>())) subtuple type
-
template<typename T>
using bbm::tuple_flatten_t = decltype(tuple_flatten(std::declval<std::decay_t<T>>())) flattened tuple type
-
template<typename T>
using bbm::tuple_add_const_t = decltype(tuple_add_const(std::declval<std::decay_t<T>>())) tuple_add_const type
-
template<typename T>
using bbm::tuple_remove_const_t = decltype(tuple_remove_const(std::declval<std::decay_t<T>>())) tuple_remove_const type
And finally, BBM support ostream forwarding of std::tuple.