0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Prevent template constructor to overload default copy cosntructors

This commit is contained in:
Roland Bock 2013-11-15 09:57:30 +01:00
parent d3e438606c
commit 16e3851847

View File

@ -38,7 +38,9 @@ namespace sqlpp
template<typename Db> template<typename Db>
struct serializable_t struct serializable_t
{ {
template<typename T> template<typename T,
typename std::enable_if<not std::is_same<typename std::decay<T>::type, serializable_t<Db>>::value, int>::type = 0 // prevent accidental overload for copy constructor
>
serializable_t(T&& t): serializable_t(T&& t):
_impl(std::make_shared<_impl_t<typename std::decay<T>::type>>(std::forward<T>(t))) _impl(std::make_shared<_impl_t<typename std::decay<T>::type>>(std::forward<T>(t)))
{} {}