X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FTypeIdValue.cci;h=e11e44b68dfbd2c3bd8aa8be6ded0d45bb805f3c;hb=a9d8ca7d0cd9d0ee9d3bd37988546d016ea5c27a;hp=e73ffd0f8961d4e92fb92836e6de24797999af22;hpb=d0db5121616e343a54adee7be05583ba1d7af2c4;p=senf.git diff --git a/senf/Utils/TypeIdValue.cci b/senf/Utils/TypeIdValue.cci index e73ffd0..e11e44b 100644 --- a/senf/Utils/TypeIdValue.cci +++ b/senf/Utils/TypeIdValue.cci @@ -27,48 +27,48 @@ // Custom includes #include "TypeInfo.hh" +#include "senfassert.hh" #define prefix_ inline ///////////////////////////////cci.p/////////////////////////////////////// prefix_ senf::TypeIdValue::TypeIdValue() - : value_(new ValueImpl()) + : p_ (&typeid(void)) {} -prefix_ senf::TypeIdValue::TypeIdValue(TypeIdValue const & other) -{ - value_.reset(other.value_->clone()); -} - -prefix_ senf::TypeIdValue const & -senf::TypeIdValue::operator=(TypeIdValue const & other) -{ - value_.reset(other.value_->clone()); - return *this; -} +prefix_ senf::TypeIdValue::TypeIdValue(std::type_info const & v) + : p_ (&v) +{} prefix_ bool senf::TypeIdValue::operator==(TypeIdValue const & other) const { - return value_->id() == other.value_->id(); + return (*p_) == (*other.p_); } prefix_ bool senf::TypeIdValue::operator<(TypeIdValue const & other) const { - return value_->id().before(other.value_->id()); + return p_->before(*other.p_); } prefix_ std::string senf::TypeIdValue::name() const { - return std::string(value_->id().name()); + return p_->name(); +} + +prefix_ std::string senf::TypeIdValue::prettyName() + const +{ + return senf::prettyName(id()); } prefix_ std::type_info const & senf::TypeIdValue::id() const { - return value_->id(); + SENF_ASSERT(p_); + return *p_; } prefix_ senf::TypeIdValue const senf::typeIdValue() @@ -78,7 +78,7 @@ prefix_ senf::TypeIdValue const senf::typeIdValue() prefix_ std::ostream & senf::operator<<(std::ostream & os, TypeIdValue const & v) { - os << prettyName(v.id()); + os << v.prettyName(); return os; }