From b4ceb7b6aecb7492b28d7a0f6c53fa657a2cd2e5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 8 Apr 2015 16:24:14 +0200 Subject: Inherit list_value directly from names --- build/variable | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'build/variable') diff --git a/build/variable b/build/variable index 67ec33c..1365d54 100644 --- a/build/variable +++ b/build/variable @@ -64,26 +64,24 @@ namespace build ~value () = default; }; - struct list_value: value + struct list_value: value, names { - names data; - public: - list_value (names d): data (std::move (d)) {} - list_value (std::string d) {data.emplace_back (std::move (d));} + list_value (names d): names (std::move (d)) {} + list_value (std::string d) {emplace_back (std::move (d));} // Note: stored in name as a directory. // - list_value (path d) {data.emplace_back (std::move (d));} + list_value (path d) {emplace_back (std::move (d));} virtual value_ptr - clone () const {return value_ptr (new list_value (data));} + clone () const {return value_ptr (new list_value (*this));} virtual bool compare (const value& v) const { const list_value* lv (dynamic_cast (&v)); - return lv != nullptr && data == lv->data; + return lv != nullptr && static_cast (*this) == *lv; } }; typedef std::unique_ptr list_value_ptr; -- cgit v1.1