File indexing completed on 2025-01-30 09:43:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_HANA_SECOND_HPP
0011 #define BOOST_HANA_SECOND_HPP
0012
0013 #include <boost/hana/fwd/second.hpp>
0014
0015 #include <boost/hana/concept/product.hpp>
0016 #include <boost/hana/config.hpp>
0017 #include <boost/hana/core/dispatch.hpp>
0018
0019
0020 namespace boost { namespace hana {
0021
0022 template <typename Pair>
0023 constexpr decltype(auto) second_t::operator()(Pair&& pair) const {
0024 using P = typename hana::tag_of<Pair>::type;
0025 using Second = BOOST_HANA_DISPATCH_IF(second_impl<P>,
0026 hana::Product<P>::value
0027 );
0028
0029 #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
0030 static_assert(hana::Product<P>::value,
0031 "hana::second(pair) requires 'pair' to be a Product");
0032 #endif
0033
0034 return Second::apply(static_cast<Pair&&>(pair));
0035 }
0036
0037
0038 template <typename P, bool condition>
0039 struct second_impl<P, when<condition>> : default_ {
0040 template <typename ...Args>
0041 static constexpr auto apply(Args&& ...) = delete;
0042 };
0043 }}
0044
0045 #endif