Skip to content

Commit 8bfdb2e

Browse files
committed
clang: use std::make_unique
1 parent 8b1a425 commit 8bfdb2e

15 files changed

Lines changed: 15 additions & 15 deletions

code/actions/BuiltinActionDefinition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class BuiltinActionDefinition : public ActionDefinition {
3030
// This should have been caught earlier
3131
Assertion(paramIter != parameterExpressions.cend(), "Could not find built-in parameter!");
3232

33-
return std::unique_ptr<Action>(new TAction(paramIter->second.template asTyped<ActionValueType>()));
33+
return std::make_unique<TAction>(paramIter->second.template asTyped<ActionValueType>());
3434
}
3535
};
3636

code/actions/expression/ProgramVariables.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace expression {
66

77
ProgramVariablesDefinition& ProgramVariablesDefinition::addScope(const SCP_string& name)
88
{
9-
auto scope = std::unique_ptr<ProgramVariablesDefinition>(new ProgramVariablesDefinition());
9+
auto scope = std::make_unique<ProgramVariablesDefinition>();
1010

1111
auto scopePtr = scope.get();
1212

code/actions/types/MoveToSubmodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ActionResult MoveToSubmodel::execute(ProgramLocals& locals) const
7070

7171
std::unique_ptr<Action> MoveToSubmodel::clone() const
7272
{
73-
return std::unique_ptr<Action>(new MoveToSubmodel(*this));
73+
return std::make_unique<MoveToSubmodel>(*this);
7474
}
7575

7676
} // namespace types

code/actions/types/ParticleEffectAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ActionResult ParticleEffectAction::execute(ProgramLocals& locals) const
6969

7070
std::unique_ptr<Action> ParticleEffectAction::clone() const
7171
{
72-
return std::unique_ptr<Action>(new ParticleEffectAction(*this));
72+
return std::make_unique<ParticleEffectAction>(*this);
7373
}
7474

7575
} // namespace types

code/actions/types/PlaySoundAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ActionResult PlaySoundAction::execute(ProgramLocals& locals) const
5757
}
5858
std::unique_ptr<Action> PlaySoundAction::clone() const
5959
{
60-
return std::unique_ptr<Action>(new PlaySoundAction(*this));
60+
return std::make_unique<PlaySoundAction>(*this);
6161
}
6262
} // namespace types
6363
} // namespace actions

code/actions/types/SetDirectionAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ActionResult SetDirectionAction::execute(ProgramLocals& locals) const
3232

3333
std::unique_ptr<Action> SetDirectionAction::clone() const
3434
{
35-
return std::unique_ptr<Action>(new SetDirectionAction(*this));
35+
return std::make_unique<SetDirectionAction>(*this);
3636
}
3737

3838
} // namespace types

code/actions/types/SetPositionAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ActionResult SetPositionAction::execute(ProgramLocals& locals) const
2727

2828
std::unique_ptr<Action> SetPositionAction::clone() const
2929
{
30-
return std::unique_ptr<Action>(new SetPositionAction(*this));
30+
return std::make_unique<SetPositionAction>(*this);
3131
}
3232

3333
} // namespace types

code/actions/types/WaitAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ActionResult WaitAction::execute(actions::ProgramLocals& locals) const
4141
}
4242
std::unique_ptr<Action> WaitAction::clone() const
4343
{
44-
return std::unique_ptr<Action>(new WaitAction(*this));
44+
return std::make_unique<WaitAction>(*this);
4545
}
4646

4747
} // namespace types

code/globalincs/vmallocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class SCP_unordered_set : public std::unordered_set<Key, Hash, KeyEqual, std::al
187187

188188
template <typename T, typename... Args>
189189
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(Args&&... args) {
190-
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
190+
return std::make_unique<T>(std::forward<Args>(args)...);
191191
}
192192
template <typename T, typename... Args>
193193
typename std::enable_if<std::is_array<T>::value, std::unique_ptr<T>>::type make_unique(std::size_t n) {

code/graphics/paths/PathRenderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace paths {
1515
std::unique_ptr<PathRenderer> PathRenderer::s_instance;
1616

1717
bool PathRenderer::init() {
18-
s_instance = std::unique_ptr<PathRenderer>(new PathRenderer());
18+
s_instance = std::make_unique<PathRenderer>();
1919

2020
return true;
2121
}

0 commit comments

Comments
 (0)