3 Defines `boost::hana::detail::nested_by`.
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_DETAIL_NESTED_BY_HPP
11 #define BOOST_HANA_DETAIL_NESTED_BY_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/detail/nested_by_fwd.hpp>
16 #include <boost/hana/functional/flip.hpp>
17 #include <boost/hana/functional/partial.hpp>
20 BOOST_HANA_NAMESPACE_BEGIN namespace detail {
22 template <typename Algorithm>
23 template <typename Predicate, typename Object>
24 constexpr decltype(auto) nested_by_t<Algorithm>::
25 operator()(Predicate&& predicate, Object&& object) const {
26 return Algorithm{}(static_cast<Object&&>(object),
27 static_cast<Predicate&&>(predicate));
30 template <typename Algorithm>
31 template <typename Predicate>
32 constexpr decltype(auto)
33 nested_by_t<Algorithm>::operator()(Predicate&& predicate) const {
34 return hana::partial(hana::flip(Algorithm{}),
35 static_cast<Predicate&&>(predicate));
38 } BOOST_HANA_NAMESPACE_END
40 #endif // !BOOST_HANA_DETAIL_NESTED_BY_HPP