]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/all_of.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / hana / all_of.hpp
1 /*!
2 @file
3 Defines `boost::hana::all_of`.
4
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)
8 */
9
10 #ifndef BOOST_HANA_ALL_OF_HPP
11 #define BOOST_HANA_ALL_OF_HPP
12
13 #include <boost/hana/fwd/all_of.hpp>
14
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/functional/compose.hpp>
20 #include <boost/hana/not.hpp>
21
22
23 BOOST_HANA_NAMESPACE_BEGIN
24 //! @cond
25 template <typename Xs, typename Pred>
26 constexpr auto all_of_t::operator()(Xs&& xs, Pred&& pred) const {
27 using S = typename hana::tag_of<Xs>::type;
28 using AllOf = BOOST_HANA_DISPATCH_IF(all_of_impl<S>,
29 hana::Searchable<S>::value
30 );
31
32 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
33 static_assert(hana::Searchable<S>::value,
34 "hana::all_of(xs, pred) requires 'xs' to be a Searchable");
35 #endif
36
37 return AllOf::apply(static_cast<Xs&&>(xs), static_cast<Pred&&>(pred));
38 }
39 //! @endcond
40
41 template <typename S, bool condition>
42 struct all_of_impl<S, when<condition>> : default_ {
43 template <typename Xs, typename Pred>
44 static constexpr auto apply(Xs&& xs, Pred&& pred) {
45 return hana::not_(hana::any_of(static_cast<Xs&&>(xs),
46 hana::compose(hana::not_, static_cast<Pred&&>(pred))));
47 }
48 };
49 BOOST_HANA_NAMESPACE_END
50
51 #endif // !BOOST_HANA_ALL_OF_HPP