memory
Typedefs | Static Functions | Member Functions
bad_node_size Class Reference

Detailed Description

The exception class thrown when the node size exceeds the supported maximum, i.e.

it is bigger than max_node_size(). It is derived from bad_allocation_size but does not override the handler.

Typedefs

using handler = void(*)(const allocator_info &info, std::size_t passed, std::size_t supported)
 The type of the handler called in the constructor of bad_allocation_size.
 

Static Functions

static handler set_handler (handler h)
 
static handler get_handler ()
 

Member Functions

 bad_node_size (const allocator_info &info, std::size_t passed, std::size_t supported)
 
const char * what () const noexcept override
 
const allocator_infoallocator () const noexcept
 
std::size_t passed_value () const noexcept
 
std::size_t supported_value () const noexcept
 

Typedefs

◆ handler

using handler = void (*)(const allocator_info& info, std::size_t passed, std::size_t supported)
inherited

The type of the handler called in the constructor of bad_allocation_size.

When a bad allocation size is detected and the exception object created, this handler gets called. It is especially useful if exception support is disabled. It gets the allocator_info, the size passed to the function and the supported size (the latter is still an upper bound).

Required Behavior:
It can log the error, throw a different exception derived from std::bad_alloc or abort the program. If it returns, this exception object will be created and thrown.
Default Behavior:
On a hosted implementation it logs the error on stderr and continues execution, leading to this exception being thrown. On a freestanding implementation it does nothing.

Constructors

◆ bad_node_size()

bad_node_size ( const allocator_info info,
std::size_t  passed,
std::size_t  supported 
)
Effects:
Just forwards to bad_allocation_size.

Member Functions

◆ what()

const char * what ( ) const
overridenoexcept
Returns:
A static NTBS that describes the error. It does not contain any specific information since there is no memory for formatting.

◆ set_handler()

static handler set_handler ( handler  h)
staticinherited
Effects:
Sets h as the new handler in an atomic operation. A nullptr sets the default handler.
Returns:
The previous handler. This is never nullptr.

◆ get_handler()

static handler get_handler ( )
staticinherited
Returns:
The current handler. This is never nullptr.

◆ allocator()

const allocator_info & allocator ( ) const
noexceptinherited
Returns:
The allocator_info passed to it in the constructor.

◆ passed_value()

std::size_t passed_value ( ) const
noexceptinherited
Returns:
The size or alignment value that was passed to the allocation function which was too big. This is the same value passed to the constructor.

◆ supported_value()

std::size_t supported_value ( ) const
noexceptinherited
Returns:
An upper bound on the maximum supported size/alignment. It is only an upper bound, values below can fail, but values above will always fail.