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 © 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  {
40  return super_type::get();
41  }
42  [[nodiscard]] constexpr typename super_type::value_type operator[](typename super_type::size_type m) const noexcept
43  {
44  return super_type::get(m);
45  }
46 };
47 
48 template<class container_t>
50  : public base_return_object_iterator<iterator<container_t, return_object_iterator<container_t>>>
51 {
53 
54 public:
56 };
57 
58 template<class container_t>
60  : public base_return_object_iterator<const_iterator<container_t, const_return_object_iterator<container_t>>>
61 {
63 
64 public:
66 };
67 
68 template<class container_t>
70  : public base_return_object_iterator<reverse_iterator<container_t, reverse_return_object_iterator<container_t>>>
71 {
73 
74 public:
76 };
77 
78 template<class container_t>
81  const_reverse_iterator<container_t, const_reverse_return_object_iterator<container_t>>>
82 {
83  using super_type =
85 
86 public:
88 };
89 
90 } // namespace qx
Basic contiguous forward iterator, meaning that incrementing an iterator will lead it moving forward.
Definition: base_iterator.h:93
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...