DUNE
Distributed and Unified Numerics Environment
DUNE PDELab (2.7)
dune
pdelab
common
utility.hh
1
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
// vi: set et ts=4 sw=2 sts=2:
3
4
#ifndef DUNE_PDELAB_COMMON_UTILITY_HH
5
#define DUNE_PDELAB_COMMON_UTILITY_HH
6
7
#include <memory>
8
9
namespace
Dune
{
10
namespace
PDELab {
11
12
19
32
template
<
typename
T>
33
std::shared_ptr<T>
ensure_shared_ptr
(T & t)
34
{
35
return
std::shared_ptr<T>(&t,
null_deleter<T>
());
36
}
37
38
#ifndef DOXYGEN
39
40
template
<
typename
T>
41
std::shared_ptr<T>
ensure_shared_ptr
(T * t)
42
{
43
return
std::shared_ptr<T>(t,
null_deleter<T>
());
44
}
45
46
template
<
typename
T>
47
std::shared_ptr<T> &
ensure_shared_ptr
(std::shared_ptr<T> & t)
48
{
49
return
t;
50
}
51
52
#endif
// DOXYGEN
53
55
56
}
// namespace PDELab
57
}
//namespace Dune
58
59
#endif
// DUNE_PDELAB_COMMON_UTILITY_HH
Dune::PDELab::ensure_shared_ptr
std::shared_ptr< T > ensure_shared_ptr(T &t)
Ensures that t is wrapped in a shared_ptr<T>
Definition:
utility.hh:33
Dune
Dune namespace.
Definition:
alignedallocator.hh:14
Dune::null_deleter
implements the Deleter concept of shared_ptr without deleting anything
Definition:
shared_ptr.hh:52
|
Legal Statements / Impressum
| Hosted by
TU Dresden
| generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)