-
Jan Trávníček authoredJan Trávníček authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
clone.hpp 504 B
/*
* clone.hpp
*
* Created on: Apr 1, 2013
* Author: Jan Travnicek
*/
#ifndef __CLONE_HPP_
#define __CLONE_HPP_
#include "type_traits.hpp"
namespace std {
template<class T, typename std::enable_if< ! std::has_clone<T>::value >::type* = nullptr>
T* clone(const T * const tmp) {
return new T(*tmp);
}
template<class T, typename std::enable_if< std::has_clone<T>::value >::type* = nullptr>
T* clone(const T * const tmp) {
return tmp->clone();
}
} /* namespace std */
#endif /* __CLONE_HPP_ */