Commit 92dbb25e authored by Ansgar Burchardt's avatar Ansgar Burchardt

[!631] use `std::make_unique` directly

Merge branch 'use-std-make_unique' into 'master'

ref:core/dune-common DUNE now requires C++14 which has std::make_unique.

See merge request [core/dune-common!631]

  [core/dune-common!631]: gitlab.dune-project.org/core/dune-common/merge_requests/631
parents b541a87c 481f921a
Pipeline #16585 passed with stage
in 9 minutes and 22 seconds
......@@ -5,8 +5,6 @@
#include <memory>
#include <dune/common/std/memory.hh>
#include "dynmatrix.hh"
/*!
......@@ -46,7 +44,7 @@ namespace Dune {
// matrix to put into dgeev
std::unique_ptr<double[]> matrixVector = Std::make_unique<double[]>(N*N);
std::unique_ptr<double[]> matrixVector = std::make_unique<double[]>(N*N);
// copy matrix
int row = 0;
......@@ -59,9 +57,9 @@ namespace Dune {
}
// working memory
std::unique_ptr<double[]> eigenR = Std::make_unique<double[]>(N);
std::unique_ptr<double[]> eigenI = Std::make_unique<double[]>(N);
std::unique_ptr<double[]> work = Std::make_unique<double[]>(3*N);
std::unique_ptr<double[]> eigenR = std::make_unique<double[]>(N);
std::unique_ptr<double[]> eigenI = std::make_unique<double[]>(N);
std::unique_ptr<double[]> work = std::make_unique<double[]>(3*N);
// return value information
long int info = 0;
......
......@@ -5,9 +5,9 @@
#include <functional>
#include <map>
#include <memory>
#include <dune/common/exceptions.hh>
#include <dune/common/std/memory.hh>
#include <dune/common/typeutilities.hh>
namespace Dune {
......@@ -166,7 +166,7 @@ class ParameterizedObjectFactory<TypeT(Args...), KeyT>
template<class Target, class... T>
static Type create(Tag<std::unique_ptr<Target>>, PriorityTag<2>, T&& ... args) {
return Dune::Std::make_unique<Impl>(std::forward<T>(args)...);
return std::make_unique<Impl>(std::forward<T>(args)...);
}
template<class Target, class... T>
......
......@@ -17,7 +17,6 @@
#include <new>
#include <dune/common/exceptions.hh>
#include <dune/common/std/memory.hh>
namespace Dune {
......@@ -91,7 +90,7 @@ namespace Dune {
std::unique_ptr<char[]> dynamicBuffer;
try {
dynamicBuffer = Dune::Std::make_unique<char[]>(dynamicBufferSize);
dynamicBuffer = std::make_unique<char[]>(dynamicBufferSize);
}
catch (const std::bad_alloc&) {
DUNE_THROW(Dune::Exception,"Could allocate large enough dynamic buffer in formatString.");
......
#include "config.h"
#include <iostream>
#include <cassert>
#include <memory>
#include <tuple>
#include <dune/common/parameterizedobject.hh>
#include <dune/common/parametertree.hh>
......@@ -14,7 +15,7 @@ DefineImplementation(InterfaceA, Bix, int);
int init_Factory()
{
globalPtrFactory<InterfaceA>().define<Aix>("Aix");
globalPtrFactory<InterfaceA>().define("Bix", [](int i) { return Dune::Std::make_unique<Bix>(i); });
globalPtrFactory<InterfaceA>().define("Bix", [](int i) { return std::make_unique<Bix>(i); });
return 0;
}
......
#include "config.h"
#include <iostream>
#include <cassert>
#include <memory>
#include <tuple>
#include <dune/common/parametertree.hh>
#include <dune/common/shared_ptr.hh>
......@@ -45,7 +46,7 @@ int main()
// Dune::ParameterizedObjectFactory<std::unique_ptr<InterfaceA>(int)> FactoryA;
globalPtrFactory<InterfaceA>().define<Ai>("Ai");
globalPtrFactory<InterfaceA>().define<Bi>("Bi");
globalPtrFactory<InterfaceA>().define("Ax", [](int /*i*/) { return Dune::Std::make_unique<Ax>(); });
globalPtrFactory<InterfaceA>().define("Ax", [](int /*i*/) { return std::make_unique<Ax>(); });
CheckInstance(globalPtrFactory<InterfaceA>(), Ai, 0);
CheckInstance(globalPtrFactory<InterfaceA>(), Bi, 1);
CheckInstance(globalPtrFactory<InterfaceA>(), Ax, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment