Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*!
0002 @file
0003 Forward declares `boost::hana::detail::nested_to`.
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_TO_FWD_HPP
0011 #define BOOST_HANA_DETAIL_NESTED_TO_FWD_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 
0015 
0016 namespace boost { namespace hana { namespace detail {
0017     template <typename Algorithm>
0018     struct nested_to_t {
0019         template <typename X>
0020         constexpr decltype(auto) operator()(X&& x) const;
0021     };
0022 
0023     //! @ingroup group-details
0024     //! Provides a `.to` static constexpr function object.
0025     //!
0026     //! When creating a binary function object of type `Algo` whose signature
0027     //! is `Object x Object -> Return`, `nested_to<Algo>` can be used as a base
0028     //! class of `Algo`. Doing so will provide a static constexpr member called
0029     //! `to`, which has the following signature:
0030     //! @code
0031     //!     Object -> Object -> Return
0032     //! @endcode
0033     //!
0034     //! Note that the function object `Algo` must be default-constructible,
0035     //! since the algorithm will be called as `Algo{}(arguments...)`.
0036     //!
0037     //! @note
0038     //! This function object is especially useful because it takes care of
0039     //! avoiding ODR violations caused by the nested static constexpr member.
0040     template <typename Algorithm>
0041     struct nested_to { static constexpr nested_to_t<Algorithm> to{}; };
0042 
0043     template <typename Algorithm>
0044     constexpr nested_to_t<Algorithm> nested_to<Algorithm>::to;
0045 } }} // end namespace boost::hana
0046 
0047 #endif // !BOOST_HANA_DETAIL_NESTED_TO_FWD_HPP