VCCC  2024.05
VisualCamp Common C++ library
range_at.hpp
Go to the documentation of this file.
1 # /*
2 # * Created by YongGyu Lee on 2020/12/08.
3 # */
4 #
5 # ifndef VCCC_TYPE_SUPPORT_DETAIL_RANGE_AT_HPP
6 # define VCCC_TYPE_SUPPORT_DETAIL_RANGE_AT_HPP
7 #
8 # include <type_traits>
9 # include <utility>
10 #
11 # include "vccc/ranges.hpp"
12 # include "vccc/utility.hpp"
13 
14 namespace vccc {
15 
25 decltype(auto)
26 at(R&& container)
27 {
28  BOUNDS_ASSERT(i, ranges::distance(container));
29  return *ranges::next(ranges::begin(container), i);
30 }
31 
34 
35 }
36 
37 # endif // VCCC_TYPE_SUPPORT_DETAIL_RANGE_AT_HPP
constexpr VCCC_INLINE_OR_STATIC detail::next_niebloid next
Definition: next.hpp:65
constexpr VCCC_INLINE_OR_STATIC detail::begin_niebloid begin
returns an iterator to the beginning of a range
Definition: begin.hpp:116
constexpr VCCC_INLINE_OR_STATIC detail::distance_niebloid distance
Definition: distance.hpp:72
constexpr decltype(auto) at(T &&t) noexcept
Return i-th element of tuple-like object.
Definition: at.hpp:46
#define BOUNDS_ASSERT(index, size)
Definition: assert.hpp:25
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35