File indexing completed on 2025-01-18 09:38:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_ALL_OF_HPP
0011 #define BOOST_HANA_ALL_OF_HPP
0012
0013 #include <boost/hana/fwd/all_of.hpp>
0014
0015 #include <boost/hana/any_of.hpp>
0016 #include <boost/hana/concept/searchable.hpp>
0017 #include <boost/hana/config.hpp>
0018 #include <boost/hana/core/dispatch.hpp>
0019 #include <boost/hana/functional/compose.hpp>
0020 #include <boost/hana/not.hpp>
0021
0022
0023 namespace boost { namespace hana {
0024
0025 template <typename Xs, typename Pred>
0026 constexpr auto all_of_t::operator()(Xs&& xs, Pred&& pred) const {
0027 using S = typename hana::tag_of<Xs>::type;
0028 using AllOf = BOOST_HANA_DISPATCH_IF(all_of_impl<S>,
0029 hana::Searchable<S>::value
0030 );
0031
0032 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
0033 static_assert(hana::Searchable<S>::value,
0034 "hana::all_of(xs, pred) requires 'xs' to be a Searchable");
0035 #endif
0036
0037 return AllOf::apply(static_cast<Xs&&>(xs), static_cast<Pred&&>(pred));
0038 }
0039
0040
0041 template <typename S, bool condition>
0042 struct all_of_impl<S, when<condition>> : default_ {
0043 template <typename Xs, typename Pred>
0044 static constexpr auto apply(Xs&& xs, Pred&& pred) {
0045 return hana::not_(hana::any_of(static_cast<Xs&&>(xs),
0046 hana::compose(hana::not_, static_cast<Pred&&>(pred))));
0047 }
0048 };
0049 }}
0050
0051 #endif