KASKADE 7 development version
utilities
memory.hh
Go to the documentation of this file.
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2
/* */
3
/* This file is part of the library KASKADE 7 */
4
/* https://www.zib.de/research/projects/kaskade7-finite-element-toolbox */
5
/* */
6
/* Copyright (C) 2016-2018 Zuse Institute Berlin */
7
/* */
8
/* KASKADE 7 is distributed under the terms of the ZIB Academic License. */
9
/* see $KASKADE/academic.txt */
10
/* */
11
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12
13
#ifndef UTILITIES_MEMORY
14
#define UTILITIES_MEMORY
15
16
namespace
Kaskade
17
{
32
template
<
class
A>
33
auto
moveUnique
(A&& a)
34
{
35
using
T = std::remove_reference_t<A>;
36
return
std::unique_ptr<T>(
new
T(std::move(a)));
37
}
38
47
template
<
class
A>
48
A
duplicate
(A
const
& a)
49
{
50
return
A(a);
51
}
52
}
53
54
55
#endif
Kaskade::moveUnique
auto moveUnique(A &&a)
Creates a dynamically allocated object from an r-value reference.
Definition:
memory.hh:33
Kaskade::duplicate
A duplicate(A const &a)
Creates a copy of a given object.
Definition:
memory.hh:48
Kaskade
Definition:
abstract_interface.hh:15
Generated on Fri Sep 6 2024 13:13:00 for KASKADE 7 development version by
1.9.4