1.1 --- a/src/core/object.h Thu Apr 17 16:24:43 2008 -0700
1.2 +++ b/src/core/object.h Fri Apr 18 14:35:10 2008 -0700
1.3 @@ -137,6 +137,8 @@
1.4 friend Ptr<T> CreateObject (const AttributeList &attributes);
1.5 template <typename T>
1.6 friend Ptr<T> CopyObject (Ptr<T> object);
1.7 + template <typename T>
1.8 + friend Ptr<T> CopyObject (Ptr<const T> object);
1.9
1.10 friend class ObjectFactory;
1.11
1.12 @@ -203,8 +205,11 @@
1.13 * and returns the new instance.
1.14 */
1.15 template <typename T>
1.16 +Ptr<T> CopyObject (Ptr<const T> object);
1.17 +template <typename T>
1.18 Ptr<T> CopyObject (Ptr<T> object);
1.19
1.20 +
1.21 /**
1.22 * \param attributes a list of attributes to set on the
1.23 * object during construction.
1.24 @@ -314,6 +319,14 @@
1.25 return p;
1.26 }
1.27
1.28 +template <typename T>
1.29 +Ptr<T> CopyObject (Ptr<const T> object)
1.30 +{
1.31 + Ptr<T> p = Ptr<T> (new T (*PeekPointer (object)), false);
1.32 + NS_ASSERT (p->m_tid == object->m_tid);
1.33 + return p;
1.34 +}
1.35 +
1.36
1.37 template <typename T>
1.38 Ptr<T> CreateObject (const AttributeList &attributes)