3 Forward declares `boost::hana::second`.
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_SECOND_HPP
11 #define BOOST_HANA_FWD_SECOND_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Returns the second element of a pair.
19 //! @ingroup group-Product
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.
30 //! @include example/second.cpp
31 #ifdef BOOST_HANA_DOXYGEN_INVOKED
32 constexpr auto second = [](auto&& product) -> decltype(auto) {
33 return tag-dispatched;
36 template <typename P, typename = void>
37 struct second_impl : second_impl<P, when<true>> { };
40 template <typename Pair>
41 constexpr decltype(auto) operator()(Pair&& pair) const;
44 constexpr second_t second{};
46 BOOST_HANA_NAMESPACE_END
48 #endif // !BOOST_HANA_FWD_SECOND_HPP