12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #ifndef BOOST_HANA_EXT_STD_PAIR_HPP
- #define BOOST_HANA_EXT_STD_PAIR_HPP
- #include <boost/hana/config.hpp>
- #include <boost/hana/fwd/core/make.hpp>
- #include <boost/hana/fwd/core/tag_of.hpp>
- #include <boost/hana/fwd/first.hpp>
- #include <boost/hana/fwd/second.hpp>
- #include <utility>
- #ifdef BOOST_HANA_DOXYGEN_INVOKED
- namespace std {
-
-
-
-
-
-
-
-
-
-
- template <typename First, typename Second>
- struct pair { };
- }
- #endif
- namespace boost { namespace hana {
- namespace ext { namespace std { struct pair_tag; }}
- template <typename First, typename Second>
- struct tag_of<std::pair<First, Second>> {
- using type = ext::std::pair_tag;
- };
-
-
-
- template <>
- struct make_impl<ext::std::pair_tag> {
- template <typename X, typename Y>
- static constexpr decltype(auto) apply(X&& x, Y&& y) {
- return std::make_pair(static_cast<X&&>(x),
- static_cast<Y&&>(y));
- }
- };
- template <>
- struct first_impl<ext::std::pair_tag> {
- template <typename T, typename U>
- static constexpr T const& apply(std::pair<T, U> const& p)
- { return p.first; }
- template <typename T, typename U>
- static constexpr T& apply(std::pair<T, U>& p)
- { return p.first; }
- template <typename T, typename U>
- static constexpr T&& apply(std::pair<T, U>&& p)
- { return static_cast<T&&>(p.first); }
- };
- template <>
- struct second_impl<ext::std::pair_tag> {
- template <typename T, typename U>
- static constexpr U const& apply(std::pair<T, U> const& p)
- { return p.second; }
- template <typename T, typename U>
- static constexpr U& apply(std::pair<T, U>& p)
- { return p.second; }
- template <typename T, typename U>
- static constexpr U&& apply(std::pair<T, U>&& p)
- { return static_cast<U&&>(p.second); }
- };
- }}
- #endif
|