]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/detail/any_of.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / detail / any_of.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Defines `boost::hana::detail::any_of`.
4
5@copyright Louis Dionne 2013-2016
6Distributed 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_DETAIL_ANY_OF_HPP
11#define BOOST_HANA_DETAIL_ANY_OF_HPP
12
13#include <boost/hana/config.hpp>
14
15#include <type_traits>
16#include <utility>
17
18
19BOOST_HANA_NAMESPACE_BEGIN namespace detail {
20 std::false_type expand(...);
21
22 template <template <typename ...> class Predicate, typename ...T>
23 decltype(expand(
24 typename std::enable_if<!Predicate<T>::value, void*>::type{}...
25 )) any_of_impl(int);
26
27 template <template <typename ...> class Predicate, typename ...T>
28 std::true_type any_of_impl(...);
29
30 //! @ingroup group-details
31 //! Returns whether the `Predicate` is satisfied by any of the `T...`.
32 //!
33 //! This metafunction will short-circuit the evaluation at the first
34 //! type satisfying the predicate, if such a type exists.
35 //!
36 //!
37 //! @note
38 //! The implementation technique used here was originally shown to
39 //! me by Eric Fiselier. All credits where due.
40 template <template <typename ...> class Predicate, typename ...T>
41 struct any_of
42 : decltype(any_of_impl<Predicate, T...>(int{}))
43 { };
44} BOOST_HANA_NAMESPACE_END
45
46#endif // !BOOST_HANA_DETAIL_ANY_OF_HPP