]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/fwd/second.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / hana / fwd / second.hpp
1 /*!
2 @file
3 Forward declares `boost::hana::second`.
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_SECOND_HPP
11 #define BOOST_HANA_FWD_SECOND_HPP
12
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
15
16
17 namespace boost { namespace hana {
18 //! Returns the second element of a pair.
19 //! @ingroup group-Product
20 //!
21 //! Note that if the `Product` actually stores the elements it contains,
22 //! `hana::second` is required to return a lvalue reference, a lvalue
23 //! reference to const or a rvalue reference to the second element, where
24 //! the type of reference must match that of the pair passed to `second`.
25 //! If the `Product` does not store the elements it contains (i.e. it
26 //! generates them on demand), this requirement is dropped.
27 //!
28 //! Example
29 //! -------
30 //! @include example/second.cpp
31 #ifdef BOOST_HANA_DOXYGEN_INVOKED
32 constexpr auto second = [](auto&& product) -> decltype(auto) {
33 return tag-dispatched;
34 };
35 #else
36 template <typename P, typename = void>
37 struct second_impl : second_impl<P, when<true>> { };
38
39 struct second_t {
40 template <typename Pair>
41 constexpr decltype(auto) operator()(Pair&& pair) const;
42 };
43
44 BOOST_HANA_INLINE_VARIABLE constexpr second_t second{};
45 #endif
46 }} // end namespace boost::hana
47
48 #endif // !BOOST_HANA_FWD_SECOND_HPP