Horizon
Loading...
Searching...
No Matches
get.hpp
Go to the documentation of this file.
1
2// 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_GET_HPP
15#define RANGES_V3_UTILITY_GET_HPP
16
17#include <meta/meta.hpp>
18
19#include <concepts/concepts.hpp>
20
21#include <range/v3/detail/adl_get.hpp>
22
23#include <range/v3/detail/prologue.hpp>
24
25namespace ranges
26{
30
32 namespace _get_
33 {
35 // clang-format off
36 template<std::size_t I, typename TupleLike>
37 constexpr auto CPP_auto_fun(get)(TupleLike &&t)
38 (
39 return detail::adl_get<I>(static_cast<TupleLike &&>(t))
40 )
41 template<typename T, typename TupleLike>
42 constexpr auto CPP_auto_fun(get)(TupleLike &&t)
43 (
44 return detail::adl_get<T>(static_cast<TupleLike &&>(t))
45 )
46 // clang-format on
47
48 template<typename T>
49 T & get(meta::id_t<T> & value) noexcept
50 {
51 return value;
52 }
53 template<typename T>
54 T const & get(meta::id_t<T> const & value) noexcept
55 {
56 return value;
57 }
58 template<typename T>
59 T && get(meta::id_t<T> && value) noexcept
60 {
61 return static_cast<T &&>(value);
62 }
64 } // namespace _get_
65 using namespace _get_;
67
69} // namespace ranges
70
71#include <range/v3/detail/epilogue.hpp>
72
73#endif
_t< id< T > > id_t
An alias for type T.
Definition meta.hpp:577
Tiny meta-programming library.