Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      Standard library header <new>

      From cppreference.com
      <cpp‎ |header
       
       
      Standard library headers
       

      This header is part of thedynamic memory management library, in particular provideslow level memory management features.

      Contents

      Classes

      exception thrown when memory allocation fails
      (class)[edit]
      exception thrown on allocation of array with invalid length
      (class)[edit]
      type used to pass alignment to alignment-aware allocation and deallocation functions
      (enum)[edit]

      Types

      function pointer type of the new handler
      (typedef)[edit]

      Tags

      a tag used to select a non-throwingallocation function
      (tag)[edit]
      a tag used to select destroying-delete overloads ofoperator delete
      (tag)[edit]

      Constants

      min offset to avoid false sharing
      max offset to promote true sharing
      (constant)[edit]

      Functions

      allocation functions
      (function)[edit]
      deallocation functions
      (function)[edit]
      obtains the current new handler
      (function)[edit]
      registers a new handler
      (function)[edit]
      (C++17)
      pointer optimization barrier
      (function template)[edit]

      [edit]Synopsis

      // all freestandingnamespace std{// storage allocation errorsclass bad_alloc;class bad_array_new_length; struct destroying_delete_t{explicit destroying_delete_t()=default;};inlineconstexpr destroying_delete_t destroying_delete{}; // global operator new controlenumclass align_val_t: size_t{}; struct nothrow_t{explicit nothrow_t()=default;};externconst nothrow_t nothrow; using new_handler=void(*)();  new_handler get_new_handler()noexcept;  new_handler set_new_handler(new_handler new_p)noexcept; // pointer optimization barriertemplate<class T>constexpr T* launder(T* p)noexcept; // hardware interference sizeinlineconstexpr size_t hardware_destructive_interference_size=/* implementation-defined */;inlineconstexpr size_t hardware_constructive_interference_size=/* implementation-defined */;} // storage allocation and deallocationvoid*operator new(std::size_t size);void*operator new(std::size_t size,std::align_val_t alignment);void*operator new(std::size_t size,conststd::nothrow_t&)noexcept;void*operator new(std::size_t size,std::align_val_t alignment,conststd::nothrow_t&)noexcept; voidoperator delete(void* ptr)noexcept;voidoperator delete(void* ptr,std::size_t size)noexcept;voidoperator delete(void* ptr,std::align_val_t alignment)noexcept;voidoperator delete(void* ptr,std::size_t size,std::align_val_t alignment)noexcept;voidoperator delete(void* ptr,conststd::nothrow_t&)noexcept;voidoperator delete(void* ptr,std::align_val_t alignment,conststd::nothrow_t&)noexcept; void*operator new[](std::size_t size);void*operator new[](std::size_t size,std::align_val_t alignment);void*operator new[](std::size_t size,conststd::nothrow_t&)noexcept;void*operator new[](std::size_t size,std::align_val_t alignment,conststd::nothrow_t&)noexcept; voidoperator delete[](void* ptr)noexcept;voidoperator delete[](void* ptr,std::size_t size)noexcept;voidoperator delete[](void* ptr,std::align_val_t alignment)noexcept;voidoperator delete[](void* ptr,std::size_t size,std::align_val_t alignment)noexcept;voidoperator delete[](void* ptr,conststd::nothrow_t&)noexcept;voidoperator delete[](void* ptr,std::align_val_t alignment,conststd::nothrow_t&)noexcept; constexprvoid*operator new(std::size_t size,void* ptr)noexcept;constexprvoid*operator new[](std::size_t size,void* ptr)noexcept;voidoperator delete(void* ptr,void*)noexcept;voidoperator delete[](void* ptr,void*)noexcept;

      [edit]Classstd::bad_alloc

      namespace std{class bad_alloc:public exception{public:// see description for the specification of the special member functionsconstexprconstchar* what()constnoexcept override;};}

      [edit]Classstd::bad_array_new_length

      namespace std{class bad_array_new_length:public bad_alloc{public:// see description for the specification of the special member functionsconstexprconstchar* what()constnoexcept override;};}
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/header/new&oldid=170819"

      [8]ページ先頭

      ©2009-2025 Movatter.jp