Replace owning naked IStream pointers with unique_ptrs

This commit is contained in:
Martin Hořeňovský 2021-08-10 00:14:18 +02:00
parent 7d0770adf2
commit 3ec63324a8
No known key found for this signature in database
GPG key ID: DE48307B8B0D381A
4 changed files with 7 additions and 12 deletions

View file

@ -123,17 +123,17 @@ namespace Detail {
///////////////////////////////////////////////////////////////////////////
auto makeStream( std::string const& filename ) -> IStream const* {
auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream const> {
if( filename.empty() )
return new Detail::CoutStream();
return Detail::make_unique<Detail::CoutStream>();
else if( filename[0] == '%' ) {
if( filename == "%debug" )
return new Detail::DebugOutStream();
return Detail::make_unique<Detail::DebugOutStream>();
else
CATCH_ERROR( "Unrecognised stream: '" << filename << "'" );
}
else
return new Detail::FileStream( filename );
return Detail::make_unique<Detail::FileStream>( filename );
}