| 5116 | target = to_string(value); |
| 5117 | } |
| 5118 | template<typename IteratorType> class iteration_proxy_value |
| 5119 | { |
| 5120 | public: |
| 5121 | using difference_type = std::ptrdiff_t; |
| 5122 | using value_type = iteration_proxy_value; |
| 5123 | using pointer = value_type *; |
| 5124 | using reference = value_type &; |
| 5125 | using iterator_category = std::input_iterator_tag; |
| 5126 | using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type; |
| 5127 | |
| 5128 | private: |
| 5129 | /// the iterator |
| 5130 | IteratorType anchor{}; |
| 5131 | /// an index for arrays (used to create key names) |
| 5132 | std::size_t array_index = 0; |
| 5133 | /// last stringified array index |
| 5134 | mutable std::size_t array_index_last = 0; |
| 5135 | /// a string representation of the array index |
| 5136 | mutable string_type array_index_str = "0"; |
| 5137 | /// an empty string (to return a reference for primitive values) |
| 5138 | string_type empty_str{}; |
| 5139 | |
| 5140 | public: |
| 5141 | explicit iteration_proxy_value() = default; |
| 5142 | explicit iteration_proxy_value(IteratorType it, std::size_t array_index_ = 0) |
| 5143 | noexcept(std::is_nothrow_move_constructible<IteratorType>::value |
| 5144 | && std::is_nothrow_default_constructible<string_type>::value) |
| 5145 | : anchor(std::move(it)) |
| 5146 | , array_index(array_index_) |
| 5147 | {} |
| 5148 | |
| 5149 | iteration_proxy_value(iteration_proxy_value const&) = default; |
| 5150 | iteration_proxy_value& operator=(iteration_proxy_value const&) = default; |
| 5151 | // older GCCs are a bit fussy and require explicit noexcept specifiers on defaulted functions |
| 5152 | iteration_proxy_value(iteration_proxy_value&&) |
| 5153 | noexcept(std::is_nothrow_move_constructible<IteratorType>::value |
| 5154 | && std::is_nothrow_move_constructible<string_type>::value) = default; |
| 5155 | iteration_proxy_value& operator=(iteration_proxy_value&&) |
| 5156 | noexcept(std::is_nothrow_move_assignable<IteratorType>::value |
| 5157 | && std::is_nothrow_move_assignable<string_type>::value) = default; |
| 5158 | ~iteration_proxy_value() = default; |
| 5159 | |
| 5160 | /// dereference operator (needed for range-based for) |
| 5161 | const iteration_proxy_value& operator*() const |
| 5162 | { |
| 5163 | return *this; |
| 5164 | } |
| 5165 | |
| 5166 | /// increment operator (needed for range-based for) |
| 5167 | iteration_proxy_value& operator++() |
| 5168 | { |
| 5169 | ++anchor; |
| 5170 | ++array_index; |
| 5171 | |
| 5172 | return *this; |
| 5173 | } |
| 5174 | |
| 5175 | iteration_proxy_value operator++(int)& // NOLINT(cert-dcl21-cpp) |
no test coverage detected