diff --git a/src/framework/otml/otmlnode.h b/src/framework/otml/otmlnode.h index 0ee338ea..8223294a 100644 --- a/src/framework/otml/otmlnode.h +++ b/src/framework/otml/otmlnode.h @@ -47,7 +47,7 @@ public: bool hasChildAt(const std::string& childTag) { return !!get(childTag); } bool hasChildAtIndex(int childIndex) { return !!getIndex(childIndex); } - void setTag(std::string tag) { m_tag = tag; } + void setTag(const std::string& tag) { m_tag = tag; } void setValue(const std::string& value) { m_value = value; } void setNull(bool null) { m_null = null; } void setUnique(bool unique) { m_unique = unique; } diff --git a/src/framework/stdext/shared_object.h b/src/framework/stdext/shared_object.h index 2dc59bec..ad47eda4 100644 --- a/src/framework/stdext/shared_object.h +++ b/src/framework/stdext/shared_object.h @@ -59,7 +59,11 @@ public: typedef T element_type; shared_object_ptr(): px(nullptr) { } - shared_object_ptr(T* p, bool add_ref = true) : px(p) { if(px != nullptr && add_ref) this->add_ref(); } + shared_object_ptr(T* p, bool add_ref = true) : px(p) { + static_assert(std::is_base_of::value, "classes using shared_object_ptr must be a derived of stdext::shared_object"); + if(px != nullptr && add_ref) + this->add_ref(); + } shared_object_ptr(shared_object_ptr const& rhs): px(rhs.px) { if(px != nullptr) add_ref(); } template shared_object_ptr(shared_object_ptr const& rhs, typename std::is_convertible::type* = nullptr) : px(rhs.get()) { if(px != nullptr) add_ref(); }