Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:52:34

0001 /*!
0002 @file
0003 Defines operators for Monads.
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_OPERATORS_MONAD_HPP
0011 #define BOOST_HANA_DETAIL_OPERATORS_MONAD_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/tag_of.hpp>
0015 #include <boost/hana/fwd/chain.hpp>
0016 
0017 #include <type_traits>
0018 
0019 
0020 namespace boost { namespace hana { namespace detail {
0021     template <typename Tag>
0022     struct monad_operators {
0023         static constexpr bool value = false;
0024     };
0025 
0026     namespace operators {
0027         template <typename Xs, typename F, typename = typename std::enable_if<
0028             detail::monad_operators<typename hana::tag_of<Xs>::type>::value
0029         >::type>
0030         constexpr auto operator|(Xs&& xs, F&& f)
0031         { return hana::chain(static_cast<Xs&&>(xs), static_cast<F&&>(f)); }
0032     } // end namespace operators
0033 } }} // end namespace boost::hana
0034 
0035 #endif // !BOOST_HANA_DETAIL_OPERATORS_MONAD_HPP