Skip to content

Commit f3670e3

Browse files
committed
Expose begin and end methods of underlying std::vector in json_arrayt.
This facilitates access to the elements in a `json_arrayt`.
1 parent 402bc56 commit f3670e3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/util/json.h

+30
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,36 @@ class json_arrayt:public jsont
178178
array.emplace_back(std::forward<argumentst>(arguments)...);
179179
}
180180

181+
std::vector<jsont>::iterator begin()
182+
{
183+
return array.begin();
184+
}
185+
186+
std::vector<jsont>::const_iterator begin() const
187+
{
188+
return array.begin();
189+
}
190+
191+
std::vector<jsont>::const_iterator cbegin() const
192+
{
193+
return array.cbegin();
194+
}
195+
196+
std::vector<jsont>::iterator end()
197+
{
198+
return array.end();
199+
}
200+
201+
std::vector<jsont>::const_iterator end() const
202+
{
203+
return array.end();
204+
}
205+
206+
std::vector<jsont>::const_iterator cend() const
207+
{
208+
return array.cend();
209+
}
210+
181211
typedef jsont value_type; // NOLINT(readability/identifiers)
182212
};
183213

0 commit comments

Comments
 (0)