• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2 @file
3 Forward declares `boost::hana::then`.
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_THEN_HPP
11 #define BOOST_HANA_FWD_THEN_HPP
12 
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15 
16 
17 BOOST_HANA_NAMESPACE_BEGIN
18     //! Sequentially compose two monadic actions, discarding any value
19     //! produced by the first but not its effects.
20     //! @ingroup group-Monad
21     //!
22     //!
23     //! @param before
24     //! The first `Monad` in the monadic composition chain. The result of
25     //! this monad is ignored, but its effects are combined with that of the
26     //! second monad.
27     //!
28     //! @param xs
29     //! The second `Monad` in the monadic composition chain.
30     //!
31     //!
32     //! Example
33     //! -------
34     //! @include example/then.cpp
35 #ifdef BOOST_HANA_DOXYGEN_INVOKED
36     constexpr auto then = [](auto&& before, auto&& xs) -> decltype(auto) {
37         return tag-dispatched;
38     };
39 #else
40     template <typename M, typename = void>
41     struct then_impl : then_impl<M, when<true>> { };
42 
43     struct then_t {
44         template <typename Before, typename Xs>
45         constexpr decltype(auto) operator()(Before&& before, Xs&& xs) const;
46     };
47 
48     constexpr then_t then{};
49 #endif
50 BOOST_HANA_NAMESPACE_END
51 
52 #endif // !BOOST_HANA_FWD_THEN_HPP
53