Skip to content

Commit

Permalink
std::basic_streambuf is immovable (why?)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrwonko committed Nov 22, 2015
1 parent f4be5d2 commit 9242bfd
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions shared/qcommon/safe/sscanf.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,6 @@ namespace Q
char* data = const_cast< CharT* >( view.data() );
this->setg( data, data, data + view.size() );
}
// alas no default move constructors on VS2013.
// TODO DELETEME once we drop VS2013 (because fuck that).
#if defined( _MSC_VER ) && _MSC_VER < 1900
ArrayViewStreambuf( ArrayViewStreambuf&& rhs )
: std::basic_streambuf< CharT >( std::move( rhs ) )
{
}
ArrayViewStreambuf& operator=( ArrayViewStreambuf&& rhs )
{
std::basic_streambuf< CharT >& self = *this;
self = std::move( rhs );
return self;
}
#endif

protected:
/// @note required by istream.tellg()
Expand Down Expand Up @@ -148,13 +134,6 @@ namespace Q
}
};

/// For deducing ArrayViewStreambuf's template type
template< typename CharT >
inline ArrayViewStreambuf< typename std::remove_cv< CharT >::type > MakeStreambuf( const gsl::array_view< const CharT >& view )
{
return std::move( ArrayViewStreambuf< typename std::remove_cv< CharT >::type >( view ) );
}

/**
Forward declaration.
*/
Expand All @@ -181,7 +160,7 @@ namespace Q
template< bool skipws, typename T, typename... Tail >
std::size_t sscanf_impl_stream( const gsl::cstring_view& input, const std::size_t accumulator, T& value, Tail&&... tail )
{
auto buf = MakeStreambuf( input );
ArrayViewStreambuf< char > buf{ input };
std::istream stream( &buf );
if( !skipws )
{
Expand Down

0 comments on commit 9242bfd

Please sign in to comment.