From: Gabriel Corona Date: Tue, 3 May 2016 10:08:50 +0000 (+0200) Subject: [config] More general comparators for Flag X-Git-Tag: v3_14~1279 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8a111804b4541b15f26dec4d5ac06115f0fca53f [config] More general comparators for Flag Fix ambiguity in overload resolution --- diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index 7b2d7a432b..1758b74ed4 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -220,14 +220,22 @@ public: operator T const&() const{ return value_; } // Basic interop with T: - Flag& operator=(T const& that) { value_ = that; return *this; } - Flag& operator=(T && that) { value_ = that; return *this; } - bool operator==(T const& that) const { return value_ == that; } - bool operator!=(T const& that) const { return value_ != that; } - bool operator<(T const& that) const { return value_ < that; } - bool operator>(T const& that) const { return value_ > that; } - bool operator<=(T const& that) const { return value_ <= that; } - bool operator>=(T const& that) const { return value_ >= that; } + template + Flag& operator=(U const& that) { value_ = that; return *this; } + template + Flag& operator=(U && that) { value_ = that; return *this; } + template + bool operator==(U const& that) const { return value_ == that; } + template + bool operator!=(U const& that) const { return value_ != that; } + template + bool operator<(U const& that) const { return value_ < that; } + template + bool operator>(U const& that) const { return value_ > that; } + template + bool operator<=(U const& that) const { return value_ <= that; } + template + bool operator>=(U const& that) const { return value_ >= that; } }; }