/usr/include/range/v3/utility/move.hpp is in librange-v3-dev 0.3.5-1.
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 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | /// \file
// Range v3 library
//
// Copyright Eric Niebler 2013-present
//
// Use, modification and distribution is subject to the
// Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Project home: https://github.com/ericniebler/range-v3
//
#ifndef RANGES_V3_UTILITY_MOVE_HPP
#define RANGES_V3_UTILITY_MOVE_HPP
#include <utility>
#include <type_traits>
#include <meta/meta.hpp>
#include <range/v3/range_fwd.hpp>
#include <range/v3/utility/static_const.hpp>
#include <range/v3/utility/associated_types.hpp>
namespace ranges
{
inline namespace v3
{
namespace aux
{
/// \ingroup group-utility
struct move_fn : move_tag
{
template<typename T,
typename U = meta::_t<std::remove_reference<T>>>
U && operator()(T && t) const noexcept
{
return static_cast<U &&>(t);
}
};
/// \ingroup group-utility
/// \sa `move_fn`
RANGES_INLINE_VARIABLE(move_fn, move)
/// \ingroup group-utility
/// \sa `move_fn`
template<typename T>
meta::_t<std::remove_reference<T>> && operator|(T && t, move_fn move) noexcept
{
return move(t);
}
/// \ingroup group-utility
/// \sa `move_fn`
template<typename R>
using move_t =
meta::if_<
std::is_reference<R>,
meta::_t<std::remove_reference<R>> &&,
detail::decay_t<R>>;
}
/// \cond
namespace adl_move_detail
{
template<typename T,
typename = decltype(iter_move(std::declval<T>()))>
std::true_type try_adl_iter_move_(int);
template<typename T>
std::false_type try_adl_iter_move_(long);
template<typename T>
struct is_adl_indirectly_movable_
: meta::id_t<decltype(adl_move_detail::try_adl_iter_move_<T>(42))>
{};
// TODO: investigate the breakage when these are made constexpr.
// (Results in ODR-use of projected_readable::operator*)
struct iter_move_fn
{
template<typename I,
typename = meta::if_c<is_adl_indirectly_movable_<I &>::value>>
auto operator()(I &&i) const
RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
(
iter_move(i)
)
template<typename I,
typename = meta::if_c<!is_adl_indirectly_movable_<I &>::value>,
typename R = decltype(*std::declval<I &>())>
auto operator()(I &&i) const
RANGES_DECLTYPE_AUTO_RETURN_NOEXCEPT
(
static_cast<aux::move_t<R>>(aux::move(*i))
)
};
}
/// \endcond
RANGES_INLINE_VARIABLE(adl_move_detail::iter_move_fn, iter_move)
/// \cond
struct indirect_move_fn
{
template<typename I>
RANGES_DEPRECATED("Please replace uses of ranges::indirect_move with ranges::iter_move.")
void operator()(I &&i) const
RANGES_AUTO_RETURN_NOEXCEPT
(
ranges::iter_move((I &&) i)
)
};
RANGES_INLINE_VARIABLE(indirect_move_fn, indirect_move)
namespace detail
{
template<typename I, typename O>
using is_indirectly_movable_ =
meta::bool_<
std::is_constructible<
meta::_t<value_type<I>>,
decltype(iter_move(std::declval<I &>()))>::value &&
std::is_assignable<
meta::_t<value_type<I>> &,
decltype(iter_move(std::declval<I &>()))>::value &&
std::is_assignable<
decltype(*std::declval<O &>()),
meta::_t<value_type<I>>>::value &&
std::is_assignable<
decltype(*std::declval<O &>()),
decltype(iter_move(std::declval<I &>()))>::value>;
template<typename I, typename O>
using is_nothrow_indirectly_movable_ =
meta::bool_<
noexcept(iter_move(std::declval<I &>())) &&
std::is_nothrow_constructible<
meta::_t<value_type<I>>,
decltype(iter_move(std::declval<I &>()))>::value &&
std::is_nothrow_assignable<
meta::_t<value_type<I>> &,
decltype(iter_move(std::declval<I &>()))>::value &&
std::is_nothrow_assignable<
decltype(*std::declval<O &>()),
meta::_t<value_type<I>>>::value &&
std::is_nothrow_assignable<
decltype(*std::declval<O &>()),
decltype(iter_move(std::declval<I &>()))>::value>;
}
/// \endcond
template<typename I, typename O>
struct is_indirectly_movable
: meta::_t<meta::if_<
meta::is_trait<meta::defer<detail::is_indirectly_movable_, I, O>>,
meta::defer<detail::is_indirectly_movable_, I, O>,
std::false_type>>
{};
template<typename I, typename O>
struct is_nothrow_indirectly_movable
: meta::_t<meta::if_<
meta::is_trait<meta::defer<detail::is_nothrow_indirectly_movable_, I, O>>,
meta::defer<detail::is_nothrow_indirectly_movable_, I, O>,
std::false_type>>
{};
}
}
#endif
|