Replace owning naked IStream pointers with unique_ptrs
This commit is contained in:
parent
7d0770adf2
commit
3ec63324a8
4 changed files with 7 additions and 12 deletions
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue