DUNE PDELab (2.8)

shared_ptr.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_SHARED_PTR_HH
5#define DUNE_SHARED_PTR_HH
6
7#include <memory>
8
15namespace Dune
16{
45 template<class T>
47 {
48 void operator() (T*) const {}
49 };
50
69 template<typename T>
70 inline std::shared_ptr<T> stackobject_to_shared_ptr(T & t)
71 {
72 return std::shared_ptr<T>(&t, null_deleter<T>());
73 }
74
75
93 template<class T>
94 auto wrap_or_move(T&& t)
95 {
96 return std::make_shared<std::decay_t<T>>(std::forward<T>(t));
97 }
98
116 template<class T>
117 auto wrap_or_move(T& t)
118 {
120 }
121
122}
123#endif
Traits for type conversions and type information.
Dune namespace.
Definition: alignedallocator.hh:11
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Create a shared_ptr for a stack-allocated object.
Definition: shared_ptr.hh:70
auto wrap_or_move(T &&t)
Capture R-value reference to shared_ptr.
Definition: shared_ptr.hh:94
implements the Deleter concept of shared_ptr without deleting anything
Definition: shared_ptr.hh:47
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Create a shared_ptr for a stack-allocated object.
Definition: shared_ptr.hh:70
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 24, 22:29, 2024)