@@ -94,25 +94,19 @@ class Object {
94
94
auto max_size () const { return data_.max_size (); }
95
95
96
96
// / Inserts a new element at the end.
97
- void insert (const value_type& _value) {
98
- data_.push_back (_value);
97
+ template <class ... Args>
98
+ void insert (const Args&... _values) {
99
+ (data_.push_back (_values), ...);
99
100
i_ = 0 ;
100
101
}
101
102
102
103
// / Inserts a new element at the end.
103
- void insert (value_type&& _value) {
104
- data_.emplace_back (std::move (_value));
104
+ template <class ... Args>
105
+ void insert (Args&&... _values) {
106
+ (data_.emplace_back (std::move (_values)), ...);
105
107
i_ = 0 ;
106
108
}
107
109
108
- // / Inserts several new elements at the end.
109
- template <class InputIt >
110
- void insert (InputIt _first, InputIt _last) {
111
- for (auto it = _first; it != _last; ++it) {
112
- insert (*it);
113
- }
114
- }
115
-
116
110
// / Inserts a new element at the end.
117
111
void insert (const std::string& _k, const T& _v) {
118
112
insert (std::make_pair (_k, _v));
@@ -152,6 +146,22 @@ class Object {
152
146
insert (_args...);
153
147
}
154
148
149
+ // / Inserts several new elements at the end.
150
+ template <class InputIt >
151
+ void insert_range (InputIt _first, InputIt _last) {
152
+ for (auto it = _first; it != _last; ++it) {
153
+ insert (*it);
154
+ }
155
+ }
156
+
157
+ // / Inserts several new elements at the end.
158
+ template <class RangeType >
159
+ void insert_range (RangeType _range) {
160
+ for (const auto & val : _range) {
161
+ insert (val);
162
+ }
163
+ }
164
+
155
165
// / Returns the element signified by the key or creates a new one.
156
166
T& operator [](const std::string& _key) {
157
167
const auto i = find (_key);
0 commit comments