qxLib
return_value_iterator.h
Go to the documentation of this file.
1 /**
2 
3  @file return_value_iterator.h
4  @author Khrapov
5  @date 2.12.2023
6  @copyright (c) Nick Khrapov, 2023. All right reserved.
7 
8 **/
9 #pragma once
10 
12 
13 namespace qx
14 {
15 
16 /**
17 
18  @class base_return_object_iterator
19  @brief This kind of iterator returns value and not reference in access methods
20  @tparam base_iterator_t - base iterator type
21  @author Khrapov
22  @date 28.01.2023
23 
24 **/
25 template<class base_iterator_t>
26 class base_return_object_iterator : public base_iterator_t
27 {
28  using super_type = base_iterator_t;
29 
30 public:
31  using value_type = typename super_type::value_type;
32  using reference = typename super_type::value_type;
33  using const_reference = typename super_type::value_type;
34 
35 public:
36  using super_type::super_type;
37 
38  [[nodiscard]] constexpr typename super_type::value_type operator*() const noexcept;
39  [[nodiscard]] constexpr typename super_type::value_type operator[](typename super_type::size_type m) const noexcept;
40 };
41 
42 template<class base_iterator_t>
45 {
46  return super_type::get();
47 }
48 
49 template<class base_iterator_t>
50 [[nodiscard]] constexpr typename base_return_object_iterator<base_iterator_t>::super_type::value_type
51  base_return_object_iterator<base_iterator_t>::operator[](typename super_type::size_type m) const noexcept
52 {
53  return super_type::get(m);
54 }
55 
56 template<class container_t>
58  : public base_return_object_iterator<iterator<container_t, return_object_iterator<container_t>>>
59 {
61 
62 public:
64 };
65 
66 template<class container_t>
68  : public base_return_object_iterator<const_iterator<container_t, const_return_object_iterator<container_t>>>
69 {
71 
72 public:
74 };
75 
76 template<class container_t>
78  : public base_return_object_iterator<reverse_iterator<container_t, reverse_return_object_iterator<container_t>>>
79 {
81 
82 public:
84 };
85 
86 template<class container_t>
89  const_reverse_iterator<container_t, const_reverse_return_object_iterator<container_t>>>
90 {
91  using super_type =
93 
94 public:
96 };
97 
98 } // namespace qx
Basic contiguous forward iterator, meaning that incrementing an iterator will lead it moving forward.
Definition: base_iterator.h:81
Base contiguous iterator with a container pointer and an index.
Definition: base_iterator.h:31
This kind of iterator returns value and not reference in access methods.
Basic contiguous reverse iterator, meaning that incrementing an iterator will lead it moving backward...