disable binary<std::vector<T>> specialization if T is not default constructible
This commit is contained in:
@@ -98,7 +98,7 @@ namespace IO {
|
||||
/// - std::vector<T> (requires a specialization for T)
|
||||
///
|
||||
/// \todo Complete documentation of members
|
||||
template < typename T > struct binary
|
||||
template < typename T, typename = void > struct binary
|
||||
{
|
||||
typedef T value_type;
|
||||
|
||||
@@ -117,14 +117,16 @@ template < typename T > struct binary
|
||||
static
|
||||
size_t store( std::ostream& /* _os */,
|
||||
const value_type& /* _v */,
|
||||
bool /* _swap=false */)
|
||||
bool /* _swap */ = false ,
|
||||
bool /* store_size */ = true ) // for vectors
|
||||
{ X; return 0; }
|
||||
|
||||
/// Restore a value of T and return the number of bytes read
|
||||
static
|
||||
size_t restore( std::istream& /* _is */,
|
||||
value_type& /* _v */,
|
||||
bool /* _swap=false */)
|
||||
bool /* _swap */ = false ,
|
||||
bool /* store_size */ = true ) // for vectors
|
||||
{ X; return 0; }
|
||||
};
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ struct FunctorRestore {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct binary< std::vector< T > > {
|
||||
struct binary< std::vector< T >, typename std::enable_if<std::is_default_constructible<T>::value>::type > {
|
||||
typedef std::vector< T > value_type;
|
||||
typedef typename value_type::value_type elem_type;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user