folly::operator_new

operator_new overloads

Synopses

Declared in <folly/lang/New.h>

Allocates s bytes and returns a pointer to the storage.

[[nodiscard]]
void*
operator_new(std::size_t const s) noexcept(noexcept(::operator new(0)));
» more...

Allocates s bytes with the given alignment.

[[nodiscard]]
void*
operator_new(
    std::size_t const s,
    std::align_val_t const a) noexcept(noexcept(::operator new(0)));
» more...

Allocates s bytes without throwing, returning null on failure.

[[nodiscard]]
void*
operator_new(
    std::size_t const s,
    std::nothrow_t const& nt) noexcept;
» more...

Allocates s bytes with the given alignment without throwing.

[[nodiscard]]
void*
operator_new(
    std::size_t const s,
    std::align_val_t const a,
    std::nothrow_t const& nt) noexcept;
» more...

Return Value

  • A pointer to the allocated storage.
  • A pointer to the allocated storage, or null on failure.

NOTE

The return value should not be discarded.

Parameters

NameDescription
sThe number of bytes to allocate.
aThe alignment of the allocated storage.
ntThe nothrow tag selecting the non-throwing overload.