thrust::pointer#
-
template<typename Element, typename Tag, typename Reference, typename Derived>
class pointer : public thrust::iterator_adaptor<Derived, Base, Value, System, Traversal, Reference, Difference># pointerstores a pointer to an object allocated in memory. Likedevice_ptr, this type ensures type safety when dispatching standard algorithms on ranges resident in memory.pointergeneralizesdevice_ptrby relaxing the backend system associated with thepointer. Instead of the backend system specified byTHRUST_DEVICE_SYSTEM,pointer'ssystem is given by its second template parameter,Tag. For the purpose of Thrust dispatch,device_ptr<Element>andpointer<Element,device_system_tag>are considered equivalent.The raw pointer encapsulated by a
pointermay be obtained through itsgetmember function or theraw_pointer_castfree function.See also
See also
reference
See also
Note
pointeris not a smart pointer; it is the client’s responsibility to deallocate memory pointer to bypointer.- Template Parameters:
Element – specifies the type of the pointed-to object.
Tag – specifies the system with which this
pointeris associated. This may be any Thrust backend system, or a user-defined tag.Reference – allows the client to specify the reference type returned upon derereference. By default, this type is
reference<Element,pointer>.Derived – allows the client to specify the name of the derived type when
pointeris used as a base class. This is useful to ensure that arithmetic on values of the derived type return values of the derived type as a result. By default, this type ispointer<Element,Tag,Reference>.
Public Types
-
using raw_pointer = typename super_t::base_type#
The type of the raw pointer
-
using base_type = Base#
The type of iterator this
iterator_adaptor'sadapts.
Public Functions
-
inline pointer()#
pointer'sdefault constructor initializes its encapsulated pointer to0
-
inline pointer(::cuda::std::nullptr_t)#
-
template<typename OtherElement>
inline explicit pointer( - OtherElement *ptr,
This constructor allows construction of a
pointer<const T, ...>from aT*.- Parameters:
ptr – A raw pointer to copy from, presumed to point to a location in
Tag'smemory.- Template Parameters:
OtherElement –
OtherElementshall be convertible toElement.
-
template<typename OtherPointer, typename detail::enable_if_pointer_is_convertible<OtherPointer, pointer>::type* = nullptr>
inline pointer( - const OtherPointer &other,
This constructor allows initialization from another pointer-like object.
- Parameters:
other – The
OtherPointerto copy.- Template Parameters:
OtherPointer – The tag associated with
OtherPointershall be convertible toTag, and its element type shall be convertible toElement.
-
inline derived_type &operator=(::cuda::std::nullptr_t)#
-
template<typename OtherPointer>
inline detail::enable_if_pointer_is_convertible<OtherPointer, pointer, derived_type&>::type operator=( - const OtherPointer &other,
Assignment operator allows assigning from another pointer-like object whose element type is convertible to
Element.- Parameters:
other – The other pointer-like object to assign from.
- Template Parameters:
OtherPointer – The tag associated with
OtherPointershall be convertible toTag, and its element type shall be convertible toElement.- Returns:
*this
-
inline Element *get() const#
getreturns thispointer'sencapsulated raw pointer.- Returns:
This
pointer'sraw pointer.
-
inline explicit operator bool() const#
-
inline Base const &base() const#
- Returns:
A
constreference to theBaseiterator thisiterator_adaptoradapts.
Public Static Functions