3 Forward declares `boost::hana::append`.
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_FWD_APPEND_HPP
11 #define BOOST_HANA_FWD_APPEND_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 namespace boost { namespace hana {
18 //! Append an element to a monadic structure.
19 //! @ingroup group-MonadPlus
21 //! Given an element `x` and a monadic structure `xs`, `append` returns a
22 //! new monadic structure which is the result of lifting `x` into the
23 //! monadic structure and then combining that (to the right) with `xs`.
26 //! append(xs, x) == concat(xs, lift<Xs>(x))
28 //! where `Xs` is the tag of `xs`. For sequences, this has the intuitive
29 //! behavior of simply appending an element to the end of the sequence,
32 //! > #### Rationale for not calling this `push_back`
33 //! > See the rationale for using `prepend` instead of `push_front`.
38 //! Given a MonadPlus `M`, the signature is
39 //! @f$ \mathtt{append} : M(T) \times T \to M(T) @f$.
42 //! A monadic structure that will be combined to the left of the element.
45 //! An element to combine to the right of the monadic structure.
50 //! @include example/append.cpp
51 #ifdef BOOST_HANA_DOXYGEN_INVOKED
52 constexpr auto append = [](auto&& xs, auto&& x) {
53 return tag-dispatched;
56 template <typename M, typename = void>
57 struct append_impl : append_impl<M, when<true>> { };
60 template <typename Xs, typename X>
61 constexpr auto operator()(Xs&& xs, X&& x) const;
64 BOOST_HANA_INLINE_VARIABLE constexpr append_t append{};
66 }} // end namespace boost::hana
68 #endif // !BOOST_HANA_FWD_APPEND_HPP