---
name: "std::__allocated_ptr"
section: "3cxx"
platform: "linux"
package: "libstdc++-10-doc"
version: "10.2.1-6"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/std::__allocated_ptr"
---

# std::\_\_allocated\_ptr(3cxx)

Non-standard RAII type for managing pointers obtained from allocators.

## NAME

std::\_\_allocated\_ptr\< \_Alloc \> - Non-standard RAII type for managing pointers obtained from allocators.

## SYNOPSIS

### Public Types

using **pointer** = typename **allocator\_traits**\< \_Alloc \>::pointer\
 using **value\_type** = typename **allocator\_traits**\< \_Alloc \>::value\_type\

### Public Member Functions

**\_\_allocated\_ptr** (**\_\_allocated\_ptr** &&\_\_gd) noexcept\
 Transfer ownership of the owned pointer.  template\<typename \_Ptr , typename \_Req  = \_Require\<is\_same\<\_Ptr, value\_type\*\>\>\> **\_\_allocated\_ptr** (\_Alloc &\_\_a, \_Ptr \_\_ptr)\
 Convert \_\_ptr to allocator's pointer type and take ownership of it.  **\_\_allocated\_ptr** (\_Alloc &\_\_a, pointer \_\_ptr) noexcept\
 Take ownership of \_\_ptr.  **~\_\_allocated\_ptr** ()\
 Deallocate the owned pointer.  value\_type \* **get** ()\
 Get the address that the owned pointer refers to.  **\_\_allocated\_ptr** & **operator=** (std::nullptr\_t) noexcept\
 Release ownership of the owned pointer.

## Detailed Description

### template\<typename \_Alloc\>

struct std::\_\_allocated\_ptr\< \_Alloc \>" Non-standard RAII type for managing pointers obtained from allocators.

Definition at line 46 of file allocated\_ptr.h.

## Constructor & Destructor Documentation

### template\<typename \_Alloc \> std::\_\_allocated\_ptr\< \_Alloc \>::\_\_allocated\_ptr (\_Alloc & \_\_a, pointer \_\_ptr)` [inline]`, ` [noexcept]`

Take ownership of \_\_ptr.

Definition at line 52 of file allocated\_ptr.h.

### template\<typename \_Alloc \> template\<typename \_Ptr , typename \_Req = \_Require\<is\_same\<\_Ptr, value\_type\*\>\>\> std::\_\_allocated\_ptr\< \_Alloc \>::\_\_allocated\_ptr (\_Alloc & \_\_a, \_Ptr \_\_ptr)` [inline]`

Convert \_\_ptr to allocator's pointer type and take ownership of it.

Definition at line 59 of file allocated\_ptr.h.

### template\<typename \_Alloc \> std::\_\_allocated\_ptr\< \_Alloc \>::\_\_allocated\_ptr (\_\_allocated\_ptr\< \_Alloc \> && \_\_gd)` [inline]`, ` [noexcept]`

Transfer ownership of the owned pointer.

Definition at line 65 of file allocated\_ptr.h.

### template\<typename \_Alloc \> std::\_\_allocated\_ptr\< \_Alloc \>::~\_\_allocated\_ptr ()` [inline]`

Deallocate the owned pointer.

Definition at line 70 of file allocated\_ptr.h.

References std::allocator\_traits\< \_Alloc \>::deallocate().

## Member Function Documentation

### template\<typename \_Alloc \> value\_type\* std::\_\_allocated\_ptr\< \_Alloc \>::get (void)` [inline]`

Get the address that the owned pointer refers to.

Definition at line 85 of file allocated\_ptr.h.

### template\<typename \_Alloc \> \_\_allocated\_ptr& std::\_\_allocated\_ptr\< \_Alloc \>::operator= (std::nullptr\_t)` [inline]`, ` [noexcept]`

Release ownership of the owned pointer.

Definition at line 78 of file allocated\_ptr.h.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
