Skip to content

Commit 53ed2e0

Browse files
committed
Use std::make_unique<> instead of internal::make_unique<>
1 parent cb98cb0 commit 53ed2e0

18 files changed

+154
-174
lines changed

include/proj/internal/internal.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ template <typename To, typename From> inline To down_cast(From *f) {
9595
return static_cast<To>(f);
9696
}
9797

98-
/* Borrowed from C++14 */
99-
template <typename T, typename... Args>
100-
std::unique_ptr<T> make_unique(Args &&...args) {
101-
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
102-
}
103-
10498
PROJ_FOR_TEST std::string replaceAll(const std::string &str,
10599
const std::string &before,
106100
const std::string &after);

src/grids.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ GTXVerticalShiftGrid *GTXVerticalShiftGrid::open(PJ_CONTEXT *ctx,
306306

307307
// Cache up to 1 megapixel per GTX file
308308
const int maxLinesInCache = 1024 * 1024 / columns;
309-
auto cache = internal::make_unique<FloatLineCache>(maxLinesInCache);
309+
auto cache = std::make_unique<FloatLineCache>(maxLinesInCache);
310310
return new GTXVerticalShiftGrid(ctx, std::move(fp), name, columns, rows,
311311
extent, std::move(cache));
312312
}
@@ -1588,8 +1588,7 @@ GTiffVGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp,
15881588
const std::string &gridName = grid->metadataItem("grid_name");
15891589
const std::string &parentName = grid->metadataItem("parent_grid_name");
15901590

1591-
auto vgrid =
1592-
internal::make_unique<GTiffVGrid>(std::move(grid), idxSample);
1591+
auto vgrid = std::make_unique<GTiffVGrid>(std::move(grid), idxSample);
15931592

15941593
insertIntoHierarchy(ctx, std::move(vgrid), gridName, parentName,
15951594
set->m_grids, mapGrids);
@@ -2324,7 +2323,7 @@ std::unique_ptr<NTv2GridSet> NTv2GridSet::open(PJ_CONTEXT *ctx,
23242323

23252324
// Cache up to 1 megapixel per NTv2 file
23262325
const int maxLinesInCache = 1024 * 1024 / largestLine;
2327-
set->m_cache = internal::make_unique<FloatLineCache>(maxLinesInCache);
2326+
set->m_cache = std::make_unique<FloatLineCache>(maxLinesInCache);
23282327
for (const auto &kv : mapGrids) {
23292328
kv.second->setCache(set->m_cache.get());
23302329
}
@@ -2633,7 +2632,7 @@ GTiffHGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp,
26332632
const std::string &gridName = grid->metadataItem("grid_name");
26342633
const std::string &parentName = grid->metadataItem("parent_grid_name");
26352634

2636-
auto hgrid = internal::make_unique<GTiffHGrid>(
2635+
auto hgrid = std::make_unique<GTiffHGrid>(
26372636
std::move(grid), idxLatShift, idxLongShift, convFactorToRadian,
26382637
positiveEast);
26392638

@@ -3030,7 +3029,7 @@ GTiffGenericGridShiftSet::open(PJ_CONTEXT *ctx, std::unique_ptr<File> fp,
30303029
const std::string &gridName = grid->metadataItem("grid_name");
30313030
const std::string &parentName = grid->metadataItem("parent_grid_name");
30323031

3033-
auto ggrid = internal::make_unique<GTiffGenericGrid>(std::move(grid));
3032+
auto ggrid = std::make_unique<GTiffGenericGrid>(std::move(grid));
30343033
if (!set->m_grids.empty() && ggrid->metadataItem("TYPE").empty() &&
30353034
!set->m_grids[0]->metadataItem("TYPE").empty()) {
30363035
ggrid->setFirstGrid(set->m_grids[0].get());

src/iso19111/c_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2751,7 +2751,7 @@ PJ_OBJ_LIST *proj_identify(PJ_CONTEXT *ctx, const PJ *obj,
27512751
++i;
27522752
}
27532753
}
2754-
auto ret = internal::make_unique<PJ_OBJ_LIST>(std::move(objects));
2754+
auto ret = std::make_unique<PJ_OBJ_LIST>(std::move(objects));
27552755
if (out_confidence) {
27562756
*out_confidence = confidenceTemp;
27572757
confidenceTemp = nullptr;

src/iso19111/common.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ UnitOfMeasure::UnitOfMeasure(const std::string &nameIn, double toSIIn,
9191
UnitOfMeasure::Type typeIn,
9292
const std::string &codeSpaceIn,
9393
const std::string &codeIn)
94-
: d(internal::make_unique<Private>(nameIn, toSIIn, typeIn, codeSpaceIn,
95-
codeIn)) {}
94+
: d(std::make_unique<Private>(nameIn, toSIIn, typeIn, codeSpaceIn,
95+
codeIn)) {}
9696

9797
// ---------------------------------------------------------------------------
9898

9999
UnitOfMeasure::UnitOfMeasure(const UnitOfMeasure &other)
100-
: d(internal::make_unique<Private>(*(other.d))) {}
100+
: d(std::make_unique<Private>(*(other.d))) {}
101101

102102
// ---------------------------------------------------------------------------
103103

@@ -376,12 +376,12 @@ struct Measure::Private {
376376
/** \brief Instantiate a Measure.
377377
*/
378378
Measure::Measure(double valueIn, const UnitOfMeasure &unitIn)
379-
: d(internal::make_unique<Private>(valueIn, unitIn)) {}
379+
: d(std::make_unique<Private>(valueIn, unitIn)) {}
380380

381381
// ---------------------------------------------------------------------------
382382

383383
Measure::Measure(const Measure &other)
384-
: d(internal::make_unique<Private>(*(other.d))) {}
384+
: d(std::make_unique<Private>(*(other.d))) {}
385385

386386
// ---------------------------------------------------------------------------
387387

@@ -555,18 +555,18 @@ struct DateTime::Private {
555555

556556
// ---------------------------------------------------------------------------
557557

558-
DateTime::DateTime() : d(internal::make_unique<Private>(std::string())) {}
558+
DateTime::DateTime() : d(std::make_unique<Private>(std::string())) {}
559559

560560
// ---------------------------------------------------------------------------
561561

562562
DateTime::DateTime(const std::string &str)
563-
: d(internal::make_unique<Private>(str)) {}
563+
: d(std::make_unique<Private>(str)) {}
564564

565565
// ---------------------------------------------------------------------------
566566

567567
//! @cond Doxygen_Suppress
568568
DateTime::DateTime(const DateTime &other)
569-
: d(internal::make_unique<Private>(*(other.d))) {}
569+
: d(std::make_unique<Private>(*(other.d))) {}
570570
//! @endcond
571571

572572
// ---------------------------------------------------------------------------
@@ -626,12 +626,12 @@ struct IdentifiedObject::Private {
626626

627627
// ---------------------------------------------------------------------------
628628

629-
IdentifiedObject::IdentifiedObject() : d(internal::make_unique<Private>()) {}
629+
IdentifiedObject::IdentifiedObject() : d(std::make_unique<Private>()) {}
630630

631631
// ---------------------------------------------------------------------------
632632

633633
IdentifiedObject::IdentifiedObject(const IdentifiedObject &other)
634-
: d(internal::make_unique<Private>(*(other.d))) {}
634+
: d(std::make_unique<Private>(*(other.d))) {}
635635

636636
// ---------------------------------------------------------------------------
637637

@@ -975,13 +975,13 @@ struct ObjectDomain::Private {
975975
//! @cond Doxygen_Suppress
976976
ObjectDomain::ObjectDomain(const optional<std::string> &scopeIn,
977977
const ExtentPtr &extent)
978-
: d(internal::make_unique<Private>(scopeIn, extent)) {}
978+
: d(std::make_unique<Private>(scopeIn, extent)) {}
979979
//! @endcond
980980

981981
// ---------------------------------------------------------------------------
982982

983983
ObjectDomain::ObjectDomain(const ObjectDomain &other)
984-
: d(internal::make_unique<Private>(*(other.d))) {}
984+
: d(std::make_unique<Private>(*(other.d))) {}
985985

986986
// ---------------------------------------------------------------------------
987987

@@ -1167,12 +1167,12 @@ struct ObjectUsage::Private {
11671167

11681168
// ---------------------------------------------------------------------------
11691169

1170-
ObjectUsage::ObjectUsage() : d(internal::make_unique<Private>()) {}
1170+
ObjectUsage::ObjectUsage() : d(std::make_unique<Private>()) {}
11711171

11721172
// ---------------------------------------------------------------------------
11731173

11741174
ObjectUsage::ObjectUsage(const ObjectUsage &other)
1175-
: IdentifiedObject(other), d(internal::make_unique<Private>(*(other.d))) {}
1175+
: IdentifiedObject(other), d(std::make_unique<Private>(*(other.d))) {}
11761176

11771177
// ---------------------------------------------------------------------------
11781178

@@ -1320,17 +1320,17 @@ struct DataEpoch::Private {
13201320

13211321
// ---------------------------------------------------------------------------
13221322

1323-
DataEpoch::DataEpoch() : d(internal::make_unique<Private>(Measure())) {}
1323+
DataEpoch::DataEpoch() : d(std::make_unique<Private>(Measure())) {}
13241324

13251325
// ---------------------------------------------------------------------------
13261326

13271327
DataEpoch::DataEpoch(const Measure &coordinateEpochIn)
1328-
: d(internal::make_unique<Private>(coordinateEpochIn)) {}
1328+
: d(std::make_unique<Private>(coordinateEpochIn)) {}
13291329

13301330
// ---------------------------------------------------------------------------
13311331

13321332
DataEpoch::DataEpoch(const DataEpoch &other)
1333-
: d(internal::make_unique<Private>(*(other.d))) {}
1333+
: d(std::make_unique<Private>(*(other.d))) {}
13341334

13351335
// ---------------------------------------------------------------------------
13361336

src/iso19111/coordinates.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,15 @@ struct CoordinateMetadata::Private {
6565
// ---------------------------------------------------------------------------
6666

6767
CoordinateMetadata::CoordinateMetadata(const crs::CRSNNPtr &crsIn)
68-
: d(internal::make_unique<Private>(crsIn)) {}
68+
: d(std::make_unique<Private>(crsIn)) {}
6969

7070
// ---------------------------------------------------------------------------
7171

7272
CoordinateMetadata::CoordinateMetadata(const crs::CRSNNPtr &crsIn,
7373
double coordinateEpochAsDecimalYearIn)
74-
: d(internal::make_unique<Private>(
75-
crsIn,
76-
common::DataEpoch(common::Measure(coordinateEpochAsDecimalYearIn,
77-
common::UnitOfMeasure::YEAR)))) {}
74+
: d(std::make_unique<Private>(crsIn, common::DataEpoch(common::Measure(
75+
coordinateEpochAsDecimalYearIn,
76+
common::UnitOfMeasure::YEAR)))) {}
7877

7978
// ---------------------------------------------------------------------------
8079

src/iso19111/coordinatesystem.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ struct Meridian::Private {
8484
// ---------------------------------------------------------------------------
8585

8686
Meridian::Meridian(const common::Angle &longitudeIn)
87-
: d(internal::make_unique<Private>(longitudeIn)) {}
87+
: d(std::make_unique<Private>(longitudeIn)) {}
8888

8989
// ---------------------------------------------------------------------------
9090

9191
#ifdef notdef
9292
Meridian::Meridian(const Meridian &other)
93-
: IdentifiedObject(other), d(internal::make_unique<Private>(*other.d)) {}
93+
: IdentifiedObject(other), d(std::make_unique<Private>(*other.d)) {}
9494
#endif
9595

9696
// ---------------------------------------------------------------------------
@@ -182,14 +182,13 @@ struct CoordinateSystemAxis::Private {
182182

183183
// ---------------------------------------------------------------------------
184184

185-
CoordinateSystemAxis::CoordinateSystemAxis()
186-
: d(internal::make_unique<Private>()) {}
185+
CoordinateSystemAxis::CoordinateSystemAxis() : d(std::make_unique<Private>()) {}
187186

188187
// ---------------------------------------------------------------------------
189188

190189
#ifdef notdef
191190
CoordinateSystemAxis::CoordinateSystemAxis(const CoordinateSystemAxis &other)
192-
: IdentifiedObject(other), d(internal::make_unique<Private>(*other.d)) {}
191+
: IdentifiedObject(other), d(std::make_unique<Private>(*other.d)) {}
193192
#endif
194193

195194
// ---------------------------------------------------------------------------
@@ -599,13 +598,13 @@ struct CoordinateSystem::Private {
599598

600599
CoordinateSystem::CoordinateSystem(
601600
const std::vector<CoordinateSystemAxisNNPtr> &axisIn)
602-
: d(internal::make_unique<Private>(axisIn)) {}
601+
: d(std::make_unique<Private>(axisIn)) {}
603602

604603
// ---------------------------------------------------------------------------
605604

606605
#ifdef notdef
607606
CoordinateSystem::CoordinateSystem(const CoordinateSystem &other)
608-
: IdentifiedObject(other), d(internal::make_unique<Private>(*other.d)) {}
607+
: IdentifiedObject(other), d(std::make_unique<Private>(*other.d)) {}
609608
#endif
610609

611610
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)