• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2 @file
3 Forward declares `boost::hana::concat`.
4 
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)
8  */
9 
10 #ifndef BOOST_HANA_FWD_CONCAT_HPP
11 #define BOOST_HANA_FWD_CONCAT_HPP
12 
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15 
16 
17 BOOST_HANA_NAMESPACE_BEGIN
18     //! Combine two monadic structures together.
19     //! @ingroup group-MonadPlus
20     //!
21     //! Given two monadic structures, `concat` combines them together and
22     //! returns a new monadic structure. The exact definition of `concat`
23     //! will depend on the exact model of MonadPlus at hand, but for
24     //! sequences it corresponds intuitively to simple concatenation.
25     //!
26     //! Also note that combination is not required to be commutative.
27     //! In other words, there is no requirement that
28     //! @code
29     //!     concat(xs, ys) == concat(ys, xs)
30     //! @endcode
31     //! and indeed it does not hold in general.
32     //!
33     //!
34     //! Signature
35     //! ---------
36     //! Given a `MonadPlus` `M`, the signature of `concat` is
37     //! @f$ \mathtt{concat} : M(T) \times M(T) \to M(T) @f$.
38     //!
39     //! @param xs, ys
40     //! Two monadic structures to combine together.
41     //!
42     //!
43     //! Example
44     //! -------
45     //! @include example/concat.cpp
46 #ifdef BOOST_HANA_DOXYGEN_INVOKED
__anon793cb9580102(auto&& xs, auto&& ys) 47     constexpr auto concat = [](auto&& xs, auto&& ys) {
48         return tag-dispatched;
49     };
50 #else
51     template <typename M, typename = void>
52     struct concat_impl : concat_impl<M, when<true>> { };
53 
54     struct concat_t {
55         template <typename Xs, typename Ys>
56         constexpr auto operator()(Xs&& xs, Ys&& ys) const;
57     };
58 
59     constexpr concat_t concat{};
60 #endif
61 BOOST_HANA_NAMESPACE_END
62 
63 #endif // !BOOST_HANA_FWD_CONCAT_HPP
64