C++ 参考手册
- C++11
- C++14
- C++17
- C++20
- C++ 编译器支持情况表
- 独立与宿主实现
- C++ 语言
- C++ 关键词
- 预处理器
- C++ 标准库头文件
- 具名要求
- 功能特性测试 (C++20)
- 工具库
- 类型支持(基本类型、RTTI、类型特性)
- 概念库 (C++20)
- 错误处理
- 动态内存管理
- std::unique_ptr
- std::scoped_allocator_adaptor
- operator==,!=(std::scoped_allocator_adaptor)
- std::scoped_allocator_adaptor 的推导指引
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::destroy
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>:: select_on_container_copy_construction
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::allocate
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::inner_allocator
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::outer_allocator
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>:: scoped_allocator_adaptor
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>:: ~scoped_allocator_adaptor
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::operator=
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::deallocate
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::max_size
- std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::construct
- std::addressof
- std::allocator_traits
- std::default_delete
- std::allocator_arg_t
- std::allocator_arg
- std::weak_ptr
- std::enable_shared_from_this
- std::bad_weak_ptr
- std::auto_ptr
- std::destroy_at
- std::destroy
- std::destroy_n
- std::uninitialized_move
- std::uninitialized_value_construct
- std::owner_less
- std::shared_ptr
- std::to_address
- std::assume_aligned
- std::make_obj_using_allocator
- C 内存管理库
- 低层内存管理
- std::pmr::memory_resource
- std::allocator
- std::pointer_traits
- std::uses_allocator
- std::uses_allocator_construction_args
- std::uninitialized_construct_using_allocator
- std::pmr::polymorphic_allocator
- std::pmr::get_default_resource
- std::pmr::set_default_resource
- std::pmr::new_delete_resource
- std::pmr::null_memory_resource
- std::pmr::synchronized_pool_resource
- std::pmr::unsynchronized_pool_resource
- std::pmr::monotonic_buffer_resource
- std::pmr::pool_options
- std::raw_storage_iterator
- std::get_temporary_buffer
- std::return_temporary_buffer
- std::uninitialized_copy
- std::uninitialized_fill
- std::uninitialized_default_construct
- std::uninitialized_copy_n
- std::uninitialized_fill_n
- std::uninitialized_move_n
- std::uninitialized_default_construct_n
- std::uninitialized_value_construct_n
- std::construct_at
- std::align
- 注释
- 日期和时间工具
- 字符串库
- 容器库
- 迭代器库
- 范围库 (C++20)
- 算法库
- 数值库
- 输入/输出库
- 文件系统库
- 本地化库
- 正则表达式库
- 原子操作库
- 线程支持库
- 实验性 C++ 特性
- 有用的资源
- 索引
- std 符号索引
- 协程支持 (C++20)
- C++ 关键词
位置:首页 > C++ 参考手册 >动态内存管理 >std::scoped_allocator_adaptor > std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::allocate
std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::allocate
定义于头文件 <scoped_allocator>
|
||
(1) | ||
pointer allocate( size_type n ); |
(C++11 起) (C++20 前) |
|
[[nodiscard]] pointer allocate( size_type n ); |
(C++20 起) | |
(2) | ||
pointer allocate( size_type n, const_void_pointer hint ); |
(C++11 起) (C++20 前) |
|
[[nodiscard]] pointer allocate( size_type n, const_void_pointer hint ); |
(C++20 起) | |
用外层分配器分配未初始化存储。
1) 调用 std::allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)
2) 附带提供内存位置提示,通过调用 std::allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)
参数
n | - | 要分配存储的对象数 |
hint | - | 指向临近内存位置的指针 |
返回值
指向分配存储的指针
参阅
分配未初始化的存储 ( std::allocator<T> 的公开成员函数) | |
[静态] |
用分配器分配未初始化的存储 ( std::allocator_traits<Alloc> 的公开静态成员函数) |