GTPin
Public Member Functions
gtpin::UniquePtr< T, D > Class Template Reference

A smart pointer that provides some of the std::unique_ptr functionality for clients that cannot use C++11 STL. More...

#include <gt_basic_defs.h>

Public Member Functions

 UniquePtr () noexcept
 Construct UniquePtr(nullptr)
 UniquePtr (pointer ptr) noexcept
 Construct UniquePtr that owns 'ptr'.
template<typename U >
 UniquePtr (UniquePtr< U, D > &&up) noexcept
 Construct UniquePtr by moving 'up' to *this.
template<typename U >
UniquePtroperator= (UniquePtr< U, D > &&rh) noexcept
 Move assignment.
 ~UniquePtr () noexcept
 Destructor.
pointer Get () const noexcept
 Return pointer to the owned object.
pointer operator-> () const noexcept
 Return pointer to the owned object.
reference operator* () const
 Return reference to the owned object.
 operator bool () const noexcept
 Return true if *this owns an object, false otherwise.
void Swap (UniquePtr &rh) noexcept
 Swap the managed objects.
pointer Release () noexcept
 Release the ownership of the managed object if any. The caller is responsible for deleting the object.
void Reset (pointer ptr=nullptr) noexcept
 Delete the managed object and replace it with the specified one.

Detailed Description

template<typename T, typename D>
class gtpin::UniquePtr< T, D >

A smart pointer that provides some of the std::unique_ptr functionality for clients that cannot use C++11 STL.

Parameters:
TType of the object managed by UniquePtr
DType of the deleter - function object that implements operator()(T*) const. For the sake of simplicity, this type is assumed to be empty (std::is_empty) - a type with no non-static data members

Member Function Documentation

template<typename T, typename D>
pointer gtpin::UniquePtr< T, D >::Release ( ) [inline]

Release the ownership of the managed object if any. The caller is responsible for deleting the object.

Returns:
Pointer to the managed object or nullptr
 All Data Structures Functions Variables Typedefs Enumerations Enumerator


  Copyright (C) 2013-2025 Intel Corporation
SPDX-License-Identifier: MIT