Skip to content
Snippets Groups Projects
Commit 6dff2c3a authored by Jan Trávníček's avatar Jan Trávníček
Browse files

move clone helper function to namespace std

parent 4d70190e
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
   
#include "type_traits.hpp" #include "type_traits.hpp"
   
namespace std { namespace ext {
   
template<class T, typename std::enable_if< ! std::has_clone<T>::value >::type* = nullptr> template<class T, typename std::enable_if< ! std::has_clone<T>::value >::type* = nullptr>
T* clone(const T * const tmp) { T* clone(const T * const tmp) {
...@@ -22,6 +22,6 @@ T* clone(const T * const tmp) { ...@@ -22,6 +22,6 @@ T* clone(const T * const tmp) {
return tmp->clone(); return tmp->clone();
} }
   
} /* namespace std */ } /* namespace ext */
   
#endif /* __CLONE_HPP_ */ #endif /* __CLONE_HPP_ */
...@@ -130,7 +130,7 @@ private: ...@@ -130,7 +130,7 @@ private:
   
T * tmp = m_Data; T * tmp = m_Data;
detach ( ); detach ( );
tmp = std::clone ( tmp ); tmp = ext::clone ( tmp );
tmp->m_UseCount = 0; tmp->m_UseCount = 0;
attach ( tmp ); attach ( tmp );
} }
...@@ -253,7 +253,7 @@ private: ...@@ -253,7 +253,7 @@ private:
   
typename cow_shared_ptr < T >::cow_shared_ptr_data * tmp = m_Data; typename cow_shared_ptr < T >::cow_shared_ptr_data * tmp = m_Data;
detach ( ); detach ( );
attach ( new cow_shared_ptr_data ( std::clone ( tmp->m_Data ) ) ); attach ( new cow_shared_ptr_data ( ext::clone ( tmp->m_Data ) ) );
} }
   
cow_shared_ptr_data * m_Data; cow_shared_ptr_data * m_Data;
...@@ -281,7 +281,7 @@ public: ...@@ -281,7 +281,7 @@ public:
smart_ptr ( smart_ptr < R > other ) : m_Data ( other.release ( ) ) { smart_ptr ( smart_ptr < R > other ) : m_Data ( other.release ( ) ) {
} }
   
smart_ptr ( const smart_ptr & other ) : m_Data ( std::clone ( other.m_Data ) ) { smart_ptr ( const smart_ptr & other ) : m_Data ( ext::clone ( other.m_Data ) ) {
} }
   
smart_ptr ( smart_ptr && other ) noexcept : m_Data ( other.release ( ) ) { smart_ptr ( smart_ptr && other ) noexcept : m_Data ( other.release ( ) ) {
...@@ -295,7 +295,7 @@ public: ...@@ -295,7 +295,7 @@ public:
if ( this == & other ) return * this; if ( this == & other ) return * this;
   
delete m_Data; delete m_Data;
m_Data = std::clone ( other.m_Data ); m_Data = ext::clone ( other.m_Data );
   
return * this; return * this;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment