/usr/include/boost/hana/pair.hpp is in libboost1.62-dev 1.62.0+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | /*!
@file
Defines `boost::hana::pair`.
@copyright Louis Dionne 2013-2016
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_PAIR_HPP
#define BOOST_HANA_PAIR_HPP
#include <boost/hana/fwd/pair.hpp>
#include <boost/hana/basic_tuple.hpp>
#include <boost/hana/config.hpp>
#include <boost/hana/detail/decay.hpp>
#include <boost/hana/detail/intrinsics.hpp>
#include <boost/hana/detail/operators/adl.hpp>
#include <boost/hana/detail/operators/comparable.hpp>
#include <boost/hana/detail/operators/orderable.hpp>
#include <boost/hana/fwd/core/make.hpp>
#include <boost/hana/fwd/first.hpp>
#include <boost/hana/fwd/second.hpp>
#include <type_traits>
#include <utility>
BOOST_HANA_NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////
// pair
//////////////////////////////////////////////////////////////////////////
//! @cond
template <typename First, typename Second>
struct pair : detail::operators::adl<pair<First, Second>> {
template <typename ...dummy, typename = typename std::enable_if<
BOOST_HANA_TT_IS_CONSTRUCTIBLE(First, dummy...) &&
BOOST_HANA_TT_IS_CONSTRUCTIBLE(Second, dummy...)
>::type>
constexpr pair()
: storage_()
{ }
template <typename ...dummy, typename = typename std::enable_if<
BOOST_HANA_TT_IS_CONSTRUCTIBLE(First, First const&, dummy...) &&
BOOST_HANA_TT_IS_CONSTRUCTIBLE(Second, Second const&, dummy...)
>::type>
constexpr pair(First const& first, Second const& second)
: storage_{first, second}
{ }
template <typename T, typename U, typename = typename std::enable_if<
BOOST_HANA_TT_IS_CONVERTIBLE(T&&, First) &&
BOOST_HANA_TT_IS_CONVERTIBLE(U&&, Second)
>::type>
constexpr pair(T&& t, U&& u)
: storage_{static_cast<T&&>(t), static_cast<U&&>(u)}
{ }
template <typename T, typename U, typename = typename std::enable_if<
BOOST_HANA_TT_IS_CONVERTIBLE(T const&, First) &&
BOOST_HANA_TT_IS_CONVERTIBLE(U const&, Second)
>::type>
constexpr pair(pair<T, U> const& other)
: storage_{hana::get_impl<0>(other.storage_),
hana::get_impl<1>(other.storage_)}
{ }
template <typename T, typename U, typename = typename std::enable_if<
BOOST_HANA_TT_IS_CONVERTIBLE(T&&, First) &&
BOOST_HANA_TT_IS_CONVERTIBLE(U&&, Second)
>::type>
constexpr pair(pair<T, U>&& other)
: storage_{static_cast<T&&>(hana::get_impl<0>(other.storage_)),
static_cast<U&&>(hana::get_impl<1>(other.storage_))}
{ }
template <typename T, typename U, typename = typename std::enable_if<
BOOST_HANA_TT_IS_ASSIGNABLE(First&, T const&) &&
BOOST_HANA_TT_IS_ASSIGNABLE(Second&, U const&)
>::type>
constexpr pair& operator=(pair<T, U> const& other) {
hana::get_impl<0>(storage_) = hana::get_impl<0>(other.storage_);
hana::get_impl<1>(storage_) = hana::get_impl<1>(other.storage_);
return *this;
}
template <typename T, typename U, typename = typename std::enable_if<
BOOST_HANA_TT_IS_ASSIGNABLE(First&, T&&) &&
BOOST_HANA_TT_IS_ASSIGNABLE(Second&, U&&)
>::type>
constexpr pair& operator=(pair<T, U>&& other) {
hana::get_impl<0>(storage_) = static_cast<T&&>(hana::get_impl<0>(other.storage_));
hana::get_impl<1>(storage_) = static_cast<U&&>(hana::get_impl<1>(other.storage_));
return *this;
}
using hana_tag = pair_tag;
basic_tuple<First, Second> storage_;
};
//! @endcond
//////////////////////////////////////////////////////////////////////////
// Operators
//////////////////////////////////////////////////////////////////////////
namespace detail {
template <>
struct comparable_operators<pair_tag> {
static constexpr bool value = true;
};
template <>
struct orderable_operators<pair_tag> {
static constexpr bool value = true;
};
}
//////////////////////////////////////////////////////////////////////////
// Product
//////////////////////////////////////////////////////////////////////////
template <>
struct make_impl<pair_tag> {
template <typename F, typename S>
static constexpr pair<
typename detail::decay<F>::type,
typename detail::decay<S>::type
> apply(F&& f, S&& s) {
return {static_cast<F&&>(f), static_cast<S&&>(s)};
}
};
template <>
struct first_impl<pair_tag> {
template <typename P>
static constexpr decltype(auto) apply(P&& p)
{ return hana::get_impl<0>(static_cast<P&&>(p).storage_); }
};
template <>
struct second_impl<pair_tag> {
template <typename P>
static constexpr decltype(auto) apply(P&& p)
{ return hana::get_impl<1>(static_cast<P&&>(p).storage_); }
};
BOOST_HANA_NAMESPACE_END
#endif // !BOOST_HANA_PAIR_HPP
|