Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:16:01

0001 /*!
0002 @file
0003 Defines `boost::hana::detail::any_of`.
0004 
0005 Copyright Louis Dionne 2013-2022
0006 Distributed under the Boost Software License, Version 1.0.
0007 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_HANA_DETAIL_ANY_OF_HPP
0011 #define BOOST_HANA_DETAIL_ANY_OF_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 
0015 #include <type_traits>
0016 #include <utility>
0017 
0018 
0019 namespace boost { namespace hana { namespace detail {
0020     std::false_type expand(...);
0021 
0022     template <template <typename ...> class Predicate, typename ...T>
0023     decltype(expand(
0024         typename std::enable_if<!Predicate<T>::value, void*>::type{}...
0025     )) any_of_impl(int);
0026 
0027     template <template <typename ...> class Predicate, typename ...T>
0028     std::true_type any_of_impl(...);
0029 
0030     //! @ingroup group-details
0031     //! Returns whether the `Predicate` is satisfied by any of the `T...`.
0032     //!
0033     //! This metafunction will short-circuit the evaluation at the first
0034     //! type satisfying the predicate, if such a type exists.
0035     //!
0036     //!
0037     //! @note
0038     //! The implementation technique used here was originally shown to
0039     //! me by Eric Fiselier. All credits where due.
0040     template <template <typename ...> class Predicate, typename ...T>
0041     struct any_of
0042         : decltype(any_of_impl<Predicate, T...>(int{}))
0043     { };
0044 } }} // end namespace boost::hana
0045 
0046 #endif // !BOOST_HANA_DETAIL_ANY_OF_HPP