3 Defines `boost::hana::none_of`.
5 @copyright Louis Dionne 2013-2017
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_NONE_OF_HPP
11 #define BOOST_HANA_NONE_OF_HPP
13 #include <boost/hana/fwd/none_of.hpp>
15 #include <boost/hana/any_of.hpp>
16 #include <boost/hana/concept/searchable.hpp>
17 #include <boost/hana/config.hpp>
18 #include <boost/hana/core/dispatch.hpp>
19 #include <boost/hana/not.hpp>
22 BOOST_HANA_NAMESPACE_BEGIN
24 template <typename Xs, typename Pred>
25 constexpr auto none_of_t::operator()(Xs&& xs, Pred&& pred) const {
26 using S = typename hana::tag_of<Xs>::type;
27 using NoneOf = BOOST_HANA_DISPATCH_IF(none_of_impl<S>,
28 hana::Searchable<S>::value
31 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
32 static_assert(hana::Searchable<S>::value,
33 "hana::none_of(xs, pred) requires 'xs' to be a Searchable");
36 return NoneOf::apply(static_cast<Xs&&>(xs), static_cast<Pred&&>(pred));
40 template <typename S, bool condition>
41 struct none_of_impl<S, when<condition>> : default_ {
42 template <typename Xs, typename Pred>
43 static constexpr auto apply(Xs&& xs, Pred&& pred) {
44 return hana::not_(hana::any_of(static_cast<Xs&&>(xs),
45 static_cast<Pred&&>(pred)));
48 BOOST_HANA_NAMESPACE_END
50 #endif // !BOOST_HANA_NONE_OF_HPP