Imported Upstream version 1.64.0
[platform/upstream/boost.git] / boost / hana / fwd / lift.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::lift`.
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_LIFT_HPP
11 #define BOOST_HANA_FWD_LIFT_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15
16
17 BOOST_HANA_NAMESPACE_BEGIN
18     //! Lift a value into an `Applicative` structure.
19     //! @ingroup group-Applicative
20     //!
21     //! `lift<A>` takes a normal value and embeds it into a structure whose
22     //! shape is represented by the `A` `Applicative`. Note that the value
23     //! may be a function, in which case the created structure may be
24     //! `ap`plied to another `Applicative` structure containing values.
25     //!
26     //!
27     //! Signature
28     //! ---------
29     //! Given an Applicative `A`, the signature is
30     //! @f$ \mathtt{lift}_A : T \to A(T) @f$.
31     //!
32     //! @tparam A
33     //! A tag representing the `Applicative` into which the value is lifted.
34     //!
35     //! @param x
36     //! The value to lift into the applicative.
37     //!
38     //!
39     //! Example
40     //! -------
41     //! @include example/lift.cpp
42 #ifdef BOOST_HANA_DOXYGEN_INVOKED
43     template <typename A>
44     constexpr auto lift = [](auto&& x) {
45         return tag-dispatched;
46     };
47 #else
48     template <typename A, typename = void>
49     struct lift_impl : lift_impl<A, when<true>> { };
50
51     template <typename A>
52     struct lift_t;
53
54     template <typename A>
55     constexpr lift_t<A> lift{};
56 #endif
57 BOOST_HANA_NAMESPACE_END
58
59 #endif // !BOOST_HANA_FWD_LIFT_HPP