Celeritas
0.5.0-56+6b053cd
|
Type-safe non-owning pointer. More...
#include <ObserverPtr.hh>
Public Member Functions | |
CELER_CONSTEXPR_FUNCTION pointer | get () const noexcept |
CELER_CONSTEXPR_FUNCTION reference | operator* () const noexcept |
CELER_CONSTEXPR_FUNCTION pointer | operator-> () const noexcept |
CELER_CONSTEXPR_FUNCTION | operator pointer () const noexcept |
CELER_CONSTEXPR_FUNCTION | operator bool () const noexcept |
CELER_CONSTEXPR_FUNCTION pointer | release () noexcept |
CELER_CONSTEXPR_FUNCTION void | reset (pointer ptr=nullptr) noexcept |
CELER_CONSTEXPR_FUNCTION void | swap (ObserverPtr &other) noexcept |
Type aliases | |
using | element_type = T |
using | pointer = std::add_pointer_t< T > |
using | reference = std::add_lvalue_reference_t< T > |
constexpr | ObserverPtr () noexcept=default |
CELER_CONSTEXPR_FUNCTION | ObserverPtr (std::nullptr_t) noexcept |
CELER_CONSTEXPR_FUNCTION | ObserverPtr (pointer ptr) noexcept |
template<class T2 > | |
CELER_CONSTEXPR_FUNCTION | ObserverPtr (ObserverPtr< T2, M > other) noexcept |
Type-safe non-owning pointer.
This class is based on WG21 N4282, "A Proposal for the World’s Dumbest Smart Pointer, v4". It adds memspace safety similar to Thrust's host/device_ptr.
The dereferencing operators can only be used from the "native" memspace: i.e., host data can be accessed from a .cc file, and device data from a .cu file.
A manual pointer cast function can be used to access the pointer with no memspace checking.
using celeritas::ObserverPtr< T, M >::element_type = T |
Construct a pointer
using celeritas::ObserverPtr< T, M >::pointer = std::add_pointer_t<T> |
Construct a pointer
using celeritas::ObserverPtr< T, M >::reference = std::add_lvalue_reference_t<T> |
Construct a pointer
|
constexprdefaultnoexcept |
Construct a pointer
|
inlinenoexcept |
Construct a pointer
|
inlineexplicitnoexcept |
Construct a pointer
|
inlinenoexcept |
Construct a pointer
|
inlinenoexcept |
Access the pointer
|
inlineexplicitnoexcept |
Access the pointer
|
inlineexplicitnoexcept |
Access the pointer
|
inlinenoexcept |
Access the pointer
|
inlinenoexcept |
Access the pointer
|
inlinenoexcept |
Modify the pointer
|
inlinenoexcept |
Modify the pointer
|
inlinenoexcept |
Modify the pointer