Horizon
move.hpp
Go to the documentation of this file.
1 // Range v3 library
3 //
4 // Copyright Eric Niebler 2013-present
5 //
6 // Use, modification and distribution is subject to the
7 // Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10 //
11 // Project home: https://github.com/ericniebler/range-v3
12 //
13 
14 #ifndef RANGES_V3_UTILITY_MOVE_HPP
15 #define RANGES_V3_UTILITY_MOVE_HPP
16 
17 #include <type_traits>
18 
19 #include <meta/meta.hpp>
20 
21 #include <range/v3/range_fwd.hpp>
22 
23 #include <range/v3/utility/static_const.hpp>
24 
25 #include <range/v3/detail/prologue.hpp>
26 
27 namespace ranges
28 {
29  namespace aux
30  {
32  struct move_fn : move_tag
33  {
34  template<typename T>
35  constexpr meta::_t<std::remove_reference<T>> && operator()(T && t) const //
36  noexcept
37  {
38  return static_cast<meta::_t<std::remove_reference<T>> &&>(t);
39  }
40 
43  template<typename T>
44  friend constexpr decltype(auto) operator|(T && t, move_fn move) noexcept
45  {
46  return move(t);
47  }
48  };
49 
53 
54 
56  template<typename R>
57  using move_t =
58  meta::if_c<std::is_reference<R>::value, meta::_t<std::remove_reference<R>> &&,
59  detail::decay_t<R>>;
60  } // namespace aux
61 } // namespace ranges
62 
63 #include <range/v3/detail/epilogue.hpp>
64 
65 #endif
RANGES_INLINE_VARIABLE(detail::to_container_fn< detail::from_range< std::vector >>, to_vector) template< template< typename... > class ContT > auto to(RANGES_HIDDEN_DETAIL(detail
For initializing a container of the specified type with the elements of an Range.
Definition: conversion.hpp:399
meta::if_c< std::is_reference< R >::value, meta::_t< std::remove_reference< R > > &&, detail::decay_t< R > > move_t
Definition: move.hpp:59
typename T::type _t
Type alias for T::type.
Definition: meta.hpp:141
Tiny meta-programming library.
Definition: move.hpp:33
Definition: move.hpp:70
Definition: range_fwd.hpp:494