UniquePtr is more standard than ScopedDeletePtr; using standard
constructs whenever possible is preferable.
This patch merits a couple explanations:
- Where it made sense, I tried to convert:
T* foo() {
UniquePtr<T> x = ...;
...
return x.release();
}
into:
UniquePtr<T> foo()
with corresponding changes inside |foo|'s body.
- The attentive reader will note that:
auto x = MakeUnique<T>(...);
is used sometimes and:
UniquePtr<T> x(new T(...));
is used sometimes. I would prefer to use the former, but was stymied
in several places due to protected constructors. (MakeUnique doesn't
have access to those protected constructors, natch.)
UniquePtr is more standard than ScopedDeletePtr; using standard
constructs whenever possible is preferable.
This patch merits a couple explanations:
- Where it made sense, I tried to convert:
T* foo() {
UniquePtr<T> x = ...;
...
return x.release();
}
into:
UniquePtr<T> foo()
with corresponding changes inside |foo|'s body.
- The attentive reader will note that:
auto x = MakeUnique<T>(...);
is used sometimes and:
UniquePtr<T> x(new T(...));
is used sometimes. I would prefer to use the former, but was stymied
in several places due to protected constructors. (MakeUnique doesn't
have access to those protected constructors, natch.)