Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:52:46

0001 /*!
0002 @file
0003 Defines `boost::hana::detail::nested_by`.
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_NESTED_BY_HPP
0011 #define BOOST_HANA_DETAIL_NESTED_BY_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/detail/nested_by_fwd.hpp>
0015 
0016 #include <boost/hana/functional/flip.hpp>
0017 #include <boost/hana/functional/partial.hpp>
0018 
0019 
0020 namespace boost { namespace hana { namespace detail {
0021     //! @cond
0022     template <typename Algorithm>
0023     template <typename Predicate, typename Object>
0024     constexpr decltype(auto) nested_by_t<Algorithm>::
0025     operator()(Predicate&& predicate, Object&& object) const {
0026         return Algorithm{}(static_cast<Object&&>(object),
0027                            static_cast<Predicate&&>(predicate));
0028     }
0029 
0030     template <typename Algorithm>
0031     template <typename Predicate>
0032     constexpr decltype(auto)
0033     nested_by_t<Algorithm>::operator()(Predicate&& predicate) const {
0034         return hana::partial(hana::flip(Algorithm{}),
0035                              static_cast<Predicate&&>(predicate));
0036     }
0037     //! @endcond
0038 } }} // end namespace boost::hana
0039 
0040 #endif // !BOOST_HANA_DETAIL_NESTED_BY_HPP