]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/include/boost/hana/fwd/duplicate.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / hana / include / boost / hana / fwd / duplicate.hpp
CommitLineData
7c673cae
FG
1/*!
2@file
3Forward declares `boost::hana::duplicate`.
4
5@copyright Louis Dionne 2013-2016
6Distributed 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_DUPLICATE_HPP
11#define BOOST_HANA_FWD_DUPLICATE_HPP
12
13#include <boost/hana/config.hpp>
14#include <boost/hana/core/when.hpp>
15
16
17BOOST_HANA_NAMESPACE_BEGIN
18 //! Add an extra layer of comonadic context to a comonadic value.
19 //! @ingroup group-Comonad
20 //!
21 //! Given a value already in a comonadic context, `duplicate` wraps this
22 //! value with an additional layer of comonadic context. This can be seen
23 //! as the dual operation to `flatten` from the Monad concept.
24 //!
25 //!
26 //! Signature
27 //! ---------
28 //! Given a Comonad `W`, the signature is
29 //! \f$
30 //! \mathtt{duplicate} : W(T) \to W(W(T))
31 //! \f$
32 //!
33 //! @param w
34 //! The value to wrap in an additional level of comonadic context.
35 //!
36 //!
37 //! Example
38 //! -------
39 //! @include example/duplicate.cpp
40#ifdef BOOST_HANA_DOXYGEN_INVOKED
41 constexpr auto duplicate = [](auto&& w) -> decltype(auto) {
42 return tag-dispatched;
43 };
44#else
45 template <typename W, typename = void>
46 struct duplicate_impl : duplicate_impl<W, when<true>> { };
47
48 struct duplicate_t {
49 template <typename W_>
50 constexpr decltype(auto) operator()(W_&& w) const;
51 };
52
53 constexpr duplicate_t duplicate{};
54#endif
55BOOST_HANA_NAMESPACE_END
56
57#endif // !BOOST_HANA_FWD_DUPLICATE_HPP