GuillaumeDua / CppShelf

Collection of powerfuls - C++ Single-Header Libraries Files
https://guillaumedua.github.io/CppShelf/
MIT License
9 stars 1 forks source link

[mp] all_of #165

Open GuillaumeDua opened 7 months ago

GuillaumeDua commented 7 months ago
// all_of
template <typename pack, template <typename> typename predicate>
struct all_of;
template <template <typename ...> typename pack, template <typename> typename predicate, typename ... Ts>
struct all_of<pack<Ts...>, predicate> : std::integral_constant<bool, (true and ... and predicate<Ts>::value)>{};
template <typename pack, template <typename> typename predicate>
constexpr auto all_of_v = all_of<pack, predicate>::value;

Or std::conjunction