Horizon
copy.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_COPY_HPP
15 #define RANGES_V3_UTILITY_COPY_HPP
16 
17 #include <concepts/concepts.hpp>
18 
19 #include <range/v3/range_fwd.hpp>
20 
21 #include <range/v3/utility/static_const.hpp>
22 
23 #include <range/v3/detail/prologue.hpp>
24 
25 namespace ranges
26 {
29  namespace aux
30  {
31  struct copy_fn : copy_tag
32  {
33  template(typename T)(
34  requires constructible_from<detail::decay_t<T>, T>)
35  constexpr auto operator()(T && t) const -> detail::decay_t<T>
36  {
37  return static_cast<T &&>(t);
38  }
39 
42  template<typename T>
43  friend constexpr auto operator|(T && t, copy_fn)
44  -> CPP_broken_friend_ret(detail::decay_t<T>)(
45  requires constructible_from<detail::decay_t<T>, T>)
46  {
47  return static_cast<T &&>(t);
48  }
49  };
50 
53  RANGES_INLINE_VARIABLE(copy_fn, copy)
54  } // namespace aux
56 } // namespace ranges
57 
58 #include <range/v3/detail/epilogue.hpp>
59 
60 #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
Definition: copy.hpp:32
Definition: range_fwd.hpp:492