mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 03:43:28 +01:00
Use Detail::make_unique<T> in more places
This commit is contained in:
parent
3ec63324a8
commit
3579c055c8
@ -43,19 +43,13 @@ namespace Catch {
|
||||
return createReporter(config->getReporterName(), config);
|
||||
}
|
||||
|
||||
// On older platforms, returning unique_ptr<ListeningReporter>
|
||||
// when the return type is unique_ptr<IStreamingReporter>
|
||||
// doesn't compile without a std::move call. However, this causes
|
||||
// a warning on newer platforms. Thus, we have to work around
|
||||
// it a bit and downcast the pointer manually.
|
||||
auto ret = Detail::unique_ptr<IStreamingReporter>(new ListeningReporter(config));
|
||||
auto& multi = static_cast<ListeningReporter&>(*ret);
|
||||
auto multi = Detail::make_unique<ListeningReporter>(config);
|
||||
auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
|
||||
for (auto const& listener : listeners) {
|
||||
multi.addListener(listener->create(Catch::ReporterConfig(config)));
|
||||
multi->addListener(listener->create(Catch::ReporterConfig(config)));
|
||||
}
|
||||
multi.addReporter(createReporter(config->getReporterName(), config));
|
||||
return ret;
|
||||
multi->addReporter(createReporter(config->getReporterName(), config));
|
||||
return multi;
|
||||
}
|
||||
|
||||
class TestGroup {
|
||||
|
@ -107,7 +107,7 @@ namespace Catch {
|
||||
makeTestCaseInfo(std::string const& _className,
|
||||
NameAndTags const& nameAndTags,
|
||||
SourceLineInfo const& _lineInfo ) {
|
||||
return Detail::unique_ptr<TestCaseInfo>(new TestCaseInfo(_className, nameAndTags, _lineInfo));
|
||||
return Detail::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo);
|
||||
}
|
||||
|
||||
TestCaseInfo::TestCaseInfo(std::string const& _className,
|
||||
|
@ -145,7 +145,7 @@ namespace Detail {
|
||||
|
||||
auto add() -> std::size_t {
|
||||
if( m_unused.empty() ) {
|
||||
m_streams.push_back( Detail::unique_ptr<std::ostringstream>( new std::ostringstream ) );
|
||||
m_streams.push_back( Detail::make_unique<std::ostringstream>() );
|
||||
return m_streams.size()-1;
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user