diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-07-14 13:50:48 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-07-14 13:50:48 +0200 |
| commit | d2b7c2442da9363b13f884bd0c47fb757cb0f005 (patch) | |
| tree | 267c12207c57d4fef4c9586dfb3a37d60e2d738c /include | |
| parent | 125a60596531cb0717869dd8c54147f79335f5c2 (diff) | |
| download | Project-Tick-d2b7c2442da9363b13f884bd0c47fb757cb0f005.tar.gz Project-Tick-d2b7c2442da9363b13f884bd0c47fb757cb0f005.zip | |
Replace constructor and dummy argument with init method
Diffstat (limited to 'include')
| -rw-r--r-- | include/tag_list.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/include/tag_list.h b/include/tag_list.h index b69eeba2fa..1a2f20e353 100644 --- a/include/tag_list.h +++ b/include/tag_list.h @@ -157,19 +157,20 @@ private: tag_type el_type_; /** - * Internally used constructor that initializes the list with tags of - * type T, with the constructor arguments of each T given by init. - * @param dummy ignored, only used for inducing the template parameter T - * @param init list of values that are, one by one, given to a constructor of T + * Internally used initialization function that initializes the list with + * tags of type T, with the constructor arguments of each T given by il. + * @param il list of values that are, one by one, given to a constructor of T */ template<class T, class Arg> - tag_list(T dummy, std::initializer_list<Arg> init); + void init(std::initializer_list<Arg> il); }; template<class T, class Arg> -tag_list tag_list::of(std::initializer_list<Arg> init) +tag_list tag_list::of(std::initializer_list<Arg> il) { - return tag_list(T(), std::move(init)); + tag_list result; + result.init<T>(il); + return result; } template<class T, class... Args> @@ -183,9 +184,9 @@ void tag_list::emplace_back(Args&&... args) } template<class T, class Arg> -tag_list::tag_list(T dummy, std::initializer_list<Arg> init): - el_type_(T::type) +void tag_list::init(std::initializer_list<Arg> init) { + el_type_ = T::type; tags.reserve(init.size()); for(const Arg& arg: init) tags.emplace_back(T(arg)); |
