Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 09:53:03

0001 /*!
0002 @file
0003 Forward declares `boost::hana::concat`.
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_FWD_CONCAT_HPP
0011 #define BOOST_HANA_FWD_CONCAT_HPP
0012 
0013 #include <boost/hana/config.hpp>
0014 #include <boost/hana/core/when.hpp>
0015 
0016 
0017 namespace boost { namespace hana {
0018     //! Combine two monadic structures together.
0019     //! @ingroup group-MonadPlus
0020     //!
0021     //! Given two monadic structures, `concat` combines them together and
0022     //! returns a new monadic structure. The exact definition of `concat`
0023     //! will depend on the exact model of MonadPlus at hand, but for
0024     //! sequences it corresponds intuitively to simple concatenation.
0025     //!
0026     //! Also note that combination is not required to be commutative.
0027     //! In other words, there is no requirement that
0028     //! @code
0029     //!     concat(xs, ys) == concat(ys, xs)
0030     //! @endcode
0031     //! and indeed it does not hold in general.
0032     //!
0033     //!
0034     //! Signature
0035     //! ---------
0036     //! Given a `MonadPlus` `M`, the signature of `concat` is
0037     //! @f$ \mathtt{concat} : M(T) \times M(T) \to M(T) @f$.
0038     //!
0039     //! @param xs, ys
0040     //! Two monadic structures to combine together.
0041     //!
0042     //!
0043     //! Example
0044     //! -------
0045     //! @include example/concat.cpp
0046 #ifdef BOOST_HANA_DOXYGEN_INVOKED
0047     constexpr auto concat = [](auto&& xs, auto&& ys) {
0048         return tag-dispatched;
0049     };
0050 #else
0051     template <typename M, typename = void>
0052     struct concat_impl : concat_impl<M, when<true>> { };
0053 
0054     struct concat_t {
0055         template <typename Xs, typename Ys>
0056         constexpr auto operator()(Xs&& xs, Ys&& ys) const;
0057     };
0058 
0059     BOOST_HANA_INLINE_VARIABLE constexpr concat_t concat{};
0060 #endif
0061 }} // end namespace boost::hana
0062 
0063 #endif // !BOOST_HANA_FWD_CONCAT_HPP