From 0060f816c7798148556ebeb445510a3cc78161f2 Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Wed, 15 Jul 2015 15:42:23 +0200 Subject: Revert "Turn tag_list::of into a subtype of tag_list" This reverts commit 6ec54ee1766a1819d62771620e91328a188341d2. --- include/tag_list.h | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/tag_list.h b/include/tag_list.h index c97aaed66d..94403119dc 100644 --- a/include/tag_list.h +++ b/include/tag_list.h @@ -42,12 +42,16 @@ public: typedef std::vector::iterator iterator; typedef std::vector::const_iterator const_iterator; - template - class of; - ///The type of the tag static constexpr tag_type type = tag_type::List; + /** + * @brief Constructs a list with the given contents of type T + * @param init list of values that are, one by one, given to a constructor of T + */ + template + static tag_list of(std::initializer_list init); + /** * @brief Constructs an empty list * @@ -148,7 +152,10 @@ public: friend bool operator==(const tag_list& lhs, const tag_list& rhs); friend bool operator!=(const tag_list& lhs, const tag_list& rhs); -protected: +private: + std::vector tags; + tag_type el_type_; + /** * Internally used initialization function that initializes the list with * tags of type T, with the constructor arguments of each T given by il. @@ -156,25 +163,15 @@ protected: */ template void init(std::initializer_list il); - -private: - std::vector tags; - tag_type el_type_; }; -/** - * @brief Subclass of tag_list with compile-time-known element type - * @todo Statically override some of the superclass methods to forgo dynamic type checking - */ template -class tag_list::of : public tag_list +tag_list tag_list::of(std::initializer_list il) { -public: - of(std::initializer_list il) - { - init(il); - } -}; + tag_list result; + result.init(il); + return result; +} template void tag_list::emplace_back(Args&&... args) -- cgit 0.0.5-2-1-g0f52