---
name: "__gnu_cxx::bitmap_allocator"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_cxx::bitmap_allocator/3cxx"
---

# \_\_gnu\_cxx::bitmap\_allocator(3cxx)

Bitmap Allocator, primary template.

## NAME

\_\_gnu\_cxx::bitmap\_allocator\< \_Tp \> - Bitmap Allocator, primary template.

## SYNOPSIS

`#include <bitmap_allocator.h>`

Inherits **\_\_gnu\_cxx::free\_list**.

### Public Types

typedef free\_list::\_\_mutex\_type **\_\_mutex\_type**\
 typedef const \_Tp \* **const\_pointer**\
 typedef const \_Tp & **const\_reference**\
 typedef std::ptrdiff\_t **difference\_type**\
 typedef \_Tp \* **pointer**\
 typedef **std::true\_type** **propagate\_on\_container\_move\_assignment**\
 typedef \_Tp & **reference**\
 typedef std::size\_t **size\_type**\
 typedef \_Tp **value\_type**\

### Public Member Functions

**bitmap\_allocator** (const **bitmap\_allocator** &) noexcept\
 template\<typename \_Tp1 \> **bitmap\_allocator** (const **bitmap\_allocator**\< \_Tp1 \> &) noexcept\
 pointer **\_M\_allocate\_single\_object** ()\
 Allocates memory for a single object of size sizeof(\_Tp).  void **\_M\_deallocate\_single\_object** (pointer \_\_p)  throw ()\
 Deallocates memory that belongs to a single object of size sizeof(\_Tp).  const\_pointer **address** (const\_reference \_\_r) const noexcept\
 pointer **address** (reference \_\_r) const noexcept\
 pointer **allocate** (size\_type \_\_n)\
 pointer **allocate** (size\_type \_\_n, typename **bitmap\_allocator**\< void \>::const\_pointer)\
 template\<typename \_Up , typename... \_Args\> void **construct** (\_Up \*\_\_p, \_Args &&... \_\_args)\
 void **deallocate** (pointer \_\_p, size\_type \_\_n)  throw ()\
 template\<typename \_Up \> void **destroy** (\_Up \*\_\_p)\
 size\_type **max\_size** () const noexcept\

## Detailed Description

### template\<typename \_Tp\>

class \_\_gnu\_cxx::bitmap\_allocator\< \_Tp \>"Bitmap Allocator, primary template.

## Member Function Documentation

### template\<typename \_Tp \> pointer \_\_gnu\_cxx::bitmap\_allocator\< \_Tp \>::\_M\_allocate\_single\_object ()` [inline]`

Allocates memory for a single object of size sizeof(\_Tp).

**Exceptions**

*std::bad\_alloc.* If memory cannot be allocated.

Complexity: Worst case complexity is O(N), but that is hardly ever hit. If and when this particular case is encountered, the next few cases are guaranteed to have a worst case complexity of O(1)! That's why this function performs very well on average. You can consider this function to have a complexity referred to commonly as: Amortized Constant time.

References **\_\_gnu\_cxx::\_\_detail::\_\_bit\_allocate()**, **\_\_gnu\_cxx::\_\_detail::\_\_num\_bitmaps()**, and **\_\_gnu\_cxx::\_Bit\_scan\_forward()**.

### template\<typename \_Tp \> void \_\_gnu\_cxx::bitmap\_allocator\< \_Tp \>::\_M\_deallocate\_single\_object (pointer \_\_p)` [inline]`

Deallocates memory that belongs to a single object of size sizeof(\_Tp). Complexity: O(lg(N)), but the worst case is not hit often! This is because containers usually deallocate memory close to each other and this case is handled in O(1) time by the deallocate function.

References **\_\_gnu\_cxx::\_\_detail::\_\_bit\_free()**, **\_\_gnu\_cxx::\_\_detail::\_\_num\_bitmaps()**, and **\_\_gnu\_cxx::free\_list::\_M\_insert()**.

## Author

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