dune-pdelab
2.5-dev
dune
pdelab
common
common/utility.hh
Go to the documentation of this file.
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
#include <dune/common/shared_ptr.hh>
10
11
namespace
Dune
{
12
namespace
PDELab {
13
14
20
34
template
<
typename
T>
35
std::shared_ptr<T>
ensure_shared_ptr
(T & t)
36
{
37
return
std::shared_ptr<T>(&t, null_deleter<T>());
38
}
39
40
#ifndef DOXYGEN
41
42
template
<
typename
T>
43
std::shared_ptr<T>
ensure_shared_ptr
(T * t)
44
{
45
return
std::shared_ptr<T>(t, null_deleter<T>());
46
}
47
48
template
<
typename
T>
49
std::shared_ptr<T> &
ensure_shared_ptr
(std::shared_ptr<T> & t)
50
{
51
return
t;
52
}
53
54
#endif // DOXYGEN
55
57
58
}
// namespace PDELab
59
}
//namespace Dune
60
61
#endif // DUNE_PDELAB_COMMON_UTILITY_HH
Dune
For backward compatibility – Do not use this!
Definition:
adaptivity.hh:28
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:
common/utility.hh:35
Generated by
1.8.17