Commit a773e56f7b83d4ff374b60e43e796190c8523781
1 parent
2a6b310a
Simplified fold expression example
Showing
1 changed file
with
2 additions
and
4 deletions
examples11/05-foldexpr/vector.h
... | ... | @@ -141,16 +141,14 @@ public: |
141 | 141 | return *(data + size++); |
142 | 142 | } |
143 | 143 | |
144 | -private: | |
145 | - template <class T> C &push_back_single(T &&s) { | |
144 | + template <class T> C &push_back(T &&s) { | |
146 | 145 | resize_before_push(); |
147 | 146 | new (data + size) C(std::forward<T>(s)); |
148 | 147 | return *(data + size++); |
149 | 148 | } |
150 | 149 | |
151 | -public: | |
152 | 150 | template <class... Args> C &push_back(Args &&... args) { |
153 | - return (push_back_single(std::forward<Args>(args)), ...); | |
151 | + return (push_back(std::forward<Args>(args)), ...); | |
154 | 152 | } |
155 | 153 | }; |
156 | 154 | #endif /* __VECTOR_H__ */ | ... | ... |