diff --git a/src/OpenMesh/Core/IO/SR_binary.hh b/src/OpenMesh/Core/IO/SR_binary.hh index 2d17b317..0dfcc09b 100644 --- a/src/OpenMesh/Core/IO/SR_binary.hh +++ b/src/OpenMesh/Core/IO/SR_binary.hh @@ -98,7 +98,7 @@ namespace IO { /// - std::vector (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; @@ -116,15 +116,17 @@ template < typename T > struct binary /// Store a value of T and return the number of bytes written static size_t store( std::ostream& /* _os */, - const value_type& /* _v */, - bool /* _swap=false */) + const value_type& /* _v */, + 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 */) + value_type& /* _v */, + bool /* _swap */ = false , + bool /* store_size */ = true ) // for vectors { X; return 0; } }; diff --git a/src/OpenMesh/Core/IO/SR_binary_spec.hh b/src/OpenMesh/Core/IO/SR_binary_spec.hh index 9cc2b49e..21242e4d 100644 --- a/src/OpenMesh/Core/IO/SR_binary_spec.hh +++ b/src/OpenMesh/Core/IO/SR_binary_spec.hh @@ -325,7 +325,7 @@ struct FunctorRestore { }; template -struct binary< std::vector< T > > { +struct binary< std::vector< T >, typename std::enable_if::value>::type > { typedef std::vector< T > value_type; typedef typename value_type::value_type elem_type; diff --git a/src/OpenMesh/Core/IO/StoreRestore.hh b/src/OpenMesh/Core/IO/StoreRestore.hh index fff14302..f2891e7b 100644 --- a/src/OpenMesh/Core/IO/StoreRestore.hh +++ b/src/OpenMesh/Core/IO/StoreRestore.hh @@ -102,7 +102,7 @@ size_t size_of(bool _store_size) { return binary< std::vector >::size_of(_store_size); } template inline -size_t store( std::ostream& _os, const T& _v, bool _swap=false) +size_t store( std::ostream& _os, const T& _v, bool _swap =false) { return binary< T >::store( _os, _v, _swap ); } template inline @@ -110,7 +110,7 @@ size_t store( std::ostream& _os, const std::vector& _v, bool _swap=false, boo { return binary< std::vector >::store( _os, _v, _swap, _store_size); } template inline -size_t restore( std::istream& _is, T& _v, bool _swap=false) +size_t restore( std::istream& _is, T& _v, bool _swap = false) { return binary< T >::restore( _is, _v, _swap ); } template inline