Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
cet::value_ptr< Element, Cloner, Deleter > Class Template Reference

#include <value_ptr.h>

Classes

struct  is_compatible
 

Public Types

using element_type = Element
 
using cloner_type = Cloner
 
using deleter_type = Deleter
 
using pointer = std::add_pointer_t< Element >
 
using reference = std::add_lvalue_reference_t< Element >
 

Public Member Functions

constexpr value_ptr () noexcept
 
constexpr value_ptr (std::nullptr_t) noexcept
 
template<class E2 >
 value_ptr (E2 *other) noexcept
 
 value_ptr (value_ptr const &other)
 
template<class E2 >
 value_ptr (value_ptr< E2, Cloner, Deleter > const &other, std::enable_if_t< is_compatible_v< E2 >> *=nullptr)
 
 value_ptr (value_ptr &&other) noexcept
 
template<class E2 >
 value_ptr (value_ptr< E2, Cloner, Deleter > &&other, std::enable_if_t< is_compatible_v< E2 >> *=nullptr) noexcept
 
 ~value_ptr () noexcept
 
value_ptroperator= (std::nullptr_t) noexcept
 
value_ptroperator= (value_ptr const &other)
 
template<class E2 >
std::enable_if_t< is_compatible_v< E2 >, value_ptr & > operator= (value_ptr< E2, Cloner, Deleter > const &other)
 
value_ptroperator= (value_ptr &&other) noexcept
 
template<class E2 >
std::enable_if_t< is_compatible_v< E2 >, value_ptr & > operator= (value_ptr< E2, Cloner, Deleter > &&other) noexcept
 
reference operator* () const
 
pointer operator-> () const noexcept
 
pointer get () const noexcept
 
 operator bool () const noexcept
 
pointer release () noexcept
 
void reset (pointer t=pointer()) noexcept
 
void swap (value_ptr &other) noexcept
 

Private Member Functions

template<class P >
pointer clone_from (P const p) const
 

Private Attributes

pointer p
 

Static Private Attributes

template<class P >
static constexpr bool is_compatible_v = is_compatible<P>::value
 

Detailed Description

template<class Element, class Cloner, class Deleter>
class cet::value_ptr< Element, Cloner, Deleter >

Definition at line 88 of file value_ptr.h.

Member Typedef Documentation

template<class Element, class Cloner, class Deleter>
using cet::value_ptr< Element, Cloner, Deleter >::cloner_type = Cloner

Definition at line 189 of file value_ptr.h.

template<class Element, class Cloner, class Deleter>
using cet::value_ptr< Element, Cloner, Deleter >::deleter_type = Deleter

Definition at line 190 of file value_ptr.h.

template<class Element, class Cloner, class Deleter>
using cet::value_ptr< Element, Cloner, Deleter >::element_type = Element

Definition at line 188 of file value_ptr.h.

template<class Element, class Cloner, class Deleter>
using cet::value_ptr< Element, Cloner, Deleter >::pointer = std::add_pointer_t<Element>

Definition at line 191 of file value_ptr.h.

template<class Element, class Cloner, class Deleter>
using cet::value_ptr< Element, Cloner, Deleter >::reference = std::add_lvalue_reference_t<Element>

Definition at line 193 of file value_ptr.h.

Constructor & Destructor Documentation

template<class Element, class Cloner, class Deleter>
constexpr cet::value_ptr< Element, Cloner, Deleter >::value_ptr ( )
inlinenoexcept

Definition at line 205 of file value_ptr.h.

205 : p{nullptr} {}
template<class Element, class Cloner, class Deleter>
constexpr cet::value_ptr< Element, Cloner, Deleter >::value_ptr ( std::nullptr_t  )
inlinenoexcept

Definition at line 208 of file value_ptr.h.

208 : p{nullptr} {}
template<class Element, class Cloner, class Deleter>
template<class E2 >
cet::value_ptr< Element, Cloner, Deleter >::value_ptr ( E2 other)
inlineexplicitnoexcept

Definition at line 211 of file value_ptr.h.

211  : p{other}
212  {
213  static_assert(is_compatible_v<E2>,
214  "value_ptr<>'s pointee type is incompatible!");
215  static_assert(
216  !std::is_polymorphic_v<E2> ||
217  !(std::is_same_v<Cloner, _::default_action<Element, false>>),
218  "value_ptr<>'s pointee type would slice when copying!");
219  }
template<class Element, class Cloner, class Deleter>
cet::value_ptr< Element, Cloner, Deleter >::value_ptr ( value_ptr< Element, Cloner, Deleter > const &  other)
inline

Definition at line 222 of file value_ptr.h.

222 : p{clone_from(other.p)} {}
pointer clone_from(P const p) const
Definition: value_ptr.h:320
template<class Element, class Cloner, class Deleter>
template<class E2 >
cet::value_ptr< Element, Cloner, Deleter >::value_ptr ( value_ptr< E2, Cloner, Deleter > const &  other,
std::enable_if_t< is_compatible_v< E2 >> *  = nullptr 
)
inline

Definition at line 225 of file value_ptr.h.

227  : p{clone_from(other.p)}
228  {}
pointer clone_from(P const p) const
Definition: value_ptr.h:320
template<class Element, class Cloner, class Deleter>
cet::value_ptr< Element, Cloner, Deleter >::value_ptr ( value_ptr< Element, Cloner, Deleter > &&  other)
inlinenoexcept

Definition at line 231 of file value_ptr.h.

231 : p{other.release()} {}
template<class Element, class Cloner, class Deleter>
template<class E2 >
cet::value_ptr< Element, Cloner, Deleter >::value_ptr ( value_ptr< E2, Cloner, Deleter > &&  other,
std::enable_if_t< is_compatible_v< E2 >> *  = nullptr 
)
inlinenoexcept

Definition at line 234 of file value_ptr.h.

236  : p(other.release())
237  {}
template<class Element, class Cloner, class Deleter>
cet::value_ptr< Element, Cloner, Deleter >::~value_ptr ( )
inlinenoexcept

Definition at line 240 of file value_ptr.h.

240 { reset(); }
void reset(pointer t=pointer()) noexcept
Definition: value_ptr.h:304

Member Function Documentation

template<class Element, class Cloner, class Deleter>
template<class P >
pointer cet::value_ptr< Element, Cloner, Deleter >::clone_from ( P const  p) const
inlineprivate

Definition at line 320 of file value_ptr.h.

321  {
322  return p ? Cloner{}(p) : nullptr;
323  }
template<class Element, class Cloner, class Deleter>
pointer cet::value_ptr< Element, Cloner, Deleter >::get ( ) const
inlinenoexcept

Definition at line 288 of file value_ptr.h.

289  {
290  return p;
291  }
template<class Element, class Cloner, class Deleter>
cet::value_ptr< Element, Cloner, Deleter >::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 293 of file value_ptr.h.

293 { return get(); }
template<class Element, class Cloner, class Deleter>
reference cet::value_ptr< Element, Cloner, Deleter >::operator* ( ) const
inline

Definition at line 285 of file value_ptr.h.

285 { return *get(); }
template<class Element, class Cloner, class Deleter>
pointer cet::value_ptr< Element, Cloner, Deleter >::operator-> ( ) const
inlinenoexcept

Definition at line 286 of file value_ptr.h.

286 { return get(); }
template<class Element, class Cloner, class Deleter>
value_ptr& cet::value_ptr< Element, Cloner, Deleter >::operator= ( std::nullptr_t  )
inlinenoexcept

Definition at line 243 of file value_ptr.h.

244  {
245  reset(nullptr);
246  return *this;
247  }
void reset(pointer t=pointer()) noexcept
Definition: value_ptr.h:304
template<class Element, class Cloner, class Deleter>
value_ptr& cet::value_ptr< Element, Cloner, Deleter >::operator= ( value_ptr< Element, Cloner, Deleter > const &  other)
inline

Definition at line 250 of file value_ptr.h.

251  {
253  swap(tmp);
254  return *this;
255  }
void swap(value_ptr &other) noexcept
Definition: value_ptr.h:310
string tmp
Definition: languages.py:63
constexpr value_ptr() noexcept
Definition: value_ptr.h:205
template<class Element, class Cloner, class Deleter>
template<class E2 >
std::enable_if_t<is_compatible_v<E2>, value_ptr&> cet::value_ptr< Element, Cloner, Deleter >::operator= ( value_ptr< E2, Cloner, Deleter > const &  other)
inline

Definition at line 259 of file value_ptr.h.

260  {
262  swap(tmp);
263  return *this;
264  }
void swap(value_ptr &other) noexcept
Definition: value_ptr.h:310
string tmp
Definition: languages.py:63
constexpr value_ptr() noexcept
Definition: value_ptr.h:205
template<class Element, class Cloner, class Deleter>
value_ptr& cet::value_ptr< Element, Cloner, Deleter >::operator= ( value_ptr< Element, Cloner, Deleter > &&  other)
inlinenoexcept

Definition at line 268 of file value_ptr.h.

269  {
271  swap(tmp);
272  return *this;
273  }
void swap(value_ptr &other) noexcept
Definition: value_ptr.h:310
def move(depos, offset)
Definition: depos.py:107
string tmp
Definition: languages.py:63
constexpr value_ptr() noexcept
Definition: value_ptr.h:205
template<class Element, class Cloner, class Deleter>
template<class E2 >
std::enable_if_t<is_compatible_v<E2>, value_ptr&> cet::value_ptr< Element, Cloner, Deleter >::operator= ( value_ptr< E2, Cloner, Deleter > &&  other)
inlinenoexcept

Definition at line 277 of file value_ptr.h.

278  {
280  swap(tmp);
281  return *this;
282  }
void swap(value_ptr &other) noexcept
Definition: value_ptr.h:310
def move(depos, offset)
Definition: depos.py:107
string tmp
Definition: languages.py:63
constexpr value_ptr() noexcept
Definition: value_ptr.h:205
template<class Element, class Cloner, class Deleter>
pointer cet::value_ptr< Element, Cloner, Deleter >::release ( )
inlinenoexcept

Definition at line 297 of file value_ptr.h.

298  {
299  pointer old = p;
300  p = nullptr;
301  return old;
302  }
std::add_pointer_t< Element > pointer
Definition: value_ptr.h:191
template<class Element, class Cloner, class Deleter>
void cet::value_ptr< Element, Cloner, Deleter >::reset ( pointer  t = pointer())
inlinenoexcept

Definition at line 304 of file value_ptr.h.

305  {
306  std::swap(p, t);
307  Deleter()(t);
308  }
void swap(value_ptr< E, C, D > &, value_ptr< E, C, D > &) noexcept
Definition: value_ptr.h:335
template<class Element, class Cloner, class Deleter>
void cet::value_ptr< Element, Cloner, Deleter >::swap ( value_ptr< Element, Cloner, Deleter > &  other)
inlinenoexcept

Definition at line 310 of file value_ptr.h.

311  {
312  std::swap(p, other.p);
313  }
void swap(value_ptr< E, C, D > &, value_ptr< E, C, D > &) noexcept
Definition: value_ptr.h:335

Member Data Documentation

template<class Element, class Cloner, class Deleter>
template<class P >
constexpr bool cet::value_ptr< Element, Cloner, Deleter >::is_compatible_v = is_compatible<P>::value
staticprivate

Definition at line 201 of file value_ptr.h.

template<class Element, class Cloner, class Deleter>
pointer cet::value_ptr< Element, Cloner, Deleter >::p
private

Definition at line 316 of file value_ptr.h.


The documentation for this class was generated from the following file: