DEENESPTFRRUARHIKOZHNL

类 ara::core::PolymorphicAllocator

[SWS_CORE_06540] Upstream: RS_AP_00130

template <class Tp = ara::core::Byte> class PolymorphicAllocator {...};

Implementation of std::pmr::polymorphic_allocator from [mem.poly.allocator.class]

Header-Datei#include "ara/core/memory_resource.h"
Forwarding-Header#include "ara/core/core_fwd.h"
Scopenamespace ara::core

用户指南人工智能生成

通过可替换的内存资源管理对象和容器的多态内存分配。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 4f3088ca1f09 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

通过可替换的内存资源管理对象和容器的多态内存分配。

该模板类将自适应应用程序和容器的基于内存资源的动态分配封装为多态分配器的完全无异常实现 [SWS_CORE_06541]。为了灵活控制对象生命周期,实例将所有内存请求委托给可替换的内存资源,其中失败的分配确定性地返回空指针而非 C++ 异常 [SWS_CORE_06547]。作为重要的功能边界条件,常规拷贝赋值被显式禁止,而在运行过程中有缺陷的释放操作始终被静默忽略。

上下文

模板类 ara::core::PolymorphicAllocator 在 AUTOSAR Adaptive 中根据 C++ 标准模式实现了有状态多态内存分配的接口,并定义了底层元素类型 value_type [SWS_CORE_06572]。它充当调用方组件(例如容器或应用程序结构)与具体内存资源之间的适配器。通过方法 resource(),可以随时查询指向所用 MemoryResource 的指针 [SWS_CORE_06557]。通过这种封装,内存请求在语义上与内存管理的具体实现分离。

diag_context caller Aufrufer / Container allocator PolymorphicAllocator caller->allocator Allokationsaufruf resource MemoryResource allocator->resource Speicherdelegierung

上下文图:分配器在调用方和内存资源之间的集成。来源:[SWS_CORE_06557]、[SWS_CORE_06572]。

生命周期

分配器的实例既可以通过默认方式 [SWS_CORE_06541] 构造,也可以使用指向特定 MemoryResource 的指针进行构造 [SWS_CORE_06542]。由于分配器仅引用内存资源,因此其生命周期的责任推测由调用方承担。 问题 Q-adde89798a03cf8b (未决)除了常规拷贝构造函数 [SWS_CORE_06543] 外,转换构造函数还允许从针对其他元素类型的分配器进行初始化 U [SWS_CORE_06544]。

关于所有权转移,常规拷贝赋值运算符已被删除(=delete)[SWS_CORE_06545]。与此相反,AUTOSAR 显式定义了一个移动构造函数 [SWS_CORE_06546] 以及一个标准移动赋值运算符 [SWS_CORE_00066]。在容器的拷贝操作中,方法 select_on_container_copy_construction() 会创建相应的分配器实例 [SWS_CORE_06573]。

在并发性方面,默认构造函数、转换构造函数以及内存资源的查询被规范为线程安全的([SWS_CORE_06541]、[SWS_CORE_06542]、[SWS_CORE_06544]、[SWS_CORE_06557])。相比之下,移动操作([SWS_CORE_06546])、拷贝选择([SWS_CORE_06573])以及所有分配、构造和解分配操作均被声明为非线程安全。

使用路径

常规流程包括内存提供、对象构造以及后续的对象销毁和释放:

分配、构造、析构与释放流程调用方PolymorphicAllocatorMemoryResourceallocate(n)Speicher anfordernSpeicheradresseTp*(或 nullptr)construct(p, args...)Objektkonstruktiondestroy(p)Objektdestruktiondeallocate(p, n)Speicher freigeben

时序图:分配、构造、销毁和释放的典型流程。来源:[SWS_CORE_06547]、[SWS_CORE_06548]、[SWS_CORE_06555]、[SWS_CORE_06556]。

错误场景

该类在核心错误处理机制上与 ISO C++ 标准不同,以满足无异常系统的严格要求:

本指南基于 AUTOSAR R25-11 中 ara::core::PolymorphicAllocator 的规范,由自动化生成。

成员图

类图

Hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); Klicken öffnet die jeweilige Klassenseite.

G nara__core__PolymorphicAllocator970 PolymorphicAllocator + PolymorphicAllocator() + operator=() + allocate() + allocate_bytes() + allocate_object() + construct() + deallocate() + deallocate_bytes() + deallocate_object() + delete_object() + destroy() + new_object() + resource() + select_on_container_copy_construction()

详细视图

请在大纲中选择一个条目。

构造函数和析构函数

≙ [mem.poly.allocator.class]

重载 PolymorphicAllocator 5
PolymorphicAllocator () noexcept; SWS_CORE_06541
PolymorphicAllocator (MemoryResource *r) noexcept; SWS_CORE_06542
PolymorphicAllocator (const PolymorphicAllocator &other) noexcept=default; SWS_CORE_06543
template <class U> PolymorphicAllocator (const PolymorphicAllocator< U > &other) noexcept; SWS_CORE_06544
PolymorphicAllocator (PolymorphicAllocator &&other) noexcept; SWS_CORE_06546

方法

allocate 函数

except for the following deviations: 1. The function is noexcept 2. If unsuccessful: nullptr is returned, instead of raising any Exception ≙ [mem.poly.allocator.class]

[[nodiscard]] Tp * allocate (std::size_t n) noexcept;

except for the following deviations: 1. The function is noexcept 2. If unsuccessful: the returned pointer shall be nullptr ≙ [mem.poly.allocator.class]

[[nodiscard]] void * allocate_bytes (std::size_t nbytes, std::size_t alignment=alignof(std::max_align_t)) noexcept;

except for the following deviations: 1. The function is noexcept 2. If unsuccessful: the returned pointer shall be nullptr ≙ [mem.poly.allocator.class]

template <class T> [[nodiscard]] T * allocate_object (std::size_t n=1) noexcept;
construct 函数

except for the following deviations: 1. Function is conditionally noexcept ≙ [mem.poly.allocator.class]

template <class T, class... Args> void construct (T *p, Args &&... args) noexcept(std::is_nothrow_ constructible< T, Args... >::value);
deallocate 函数

except for the following deviations: 1. The function is noexcept 2. If unsuccessful: errors will be silently ignored ≙ [mem.poly.allocator.class]

void deallocate (Tp *p, std::size_t n) noexcept;

except for the following deviations: 1. The function is noexcept 2. If unsuccessful: errors will be silently ignored ≙ [mem.poly.allocator.class]

void deallocate_bytes (void *p, std::size_t nbytes, std::size_t alignment=alignof(std::max_align_t)) noexcept;

except for the following deviations: 1. Function is nullptr 2. If unsuccessful: errors will be silently ignored ≙ [mem.poly.allocator.class]

template <class T> void deallocate_object (T *p, std::size_t n=1) noexcept;

except for the following deviations: 1. Function is conditionally noexcept 2. If unsuccessful: errors will be silently ignored ≙ [mem.poly.allocator.class]

template <class T> void delete_object (T *p) noexcept(std::is_nothrow_destructible< T >::value);
destroy 函数

except for the following deviations: 1. Function is conditionally noexcept ≙ [mem.poly.allocator.class]

template <class T> void destroy (T *p) noexcept(std::is_nothrow_destructible< T >::value);
new_object 函数

except for the following deviations: 1. Function is conditionally noexcept 2. If unsuccessful: nullptr is returned, instead of raising any Exception ≙ [mem.poly.allocator.class]

template <class T, class... CtorArgs> [[nodiscard]] T * new_object (CtorArgs &&... ctor_args) noexcept(std::is_nothrow_constructible< T, CtorArgs... >::value);
resource 函数

≙ [mem.poly.allocator.class]

MemoryResource * resource () const noexcept;

except for the following deviations: 1. The function is noexcept ≙ [mem.poly.allocator.class]

PolymorphicAllocator select_on_container_copy_construction () const noexcept;

运算符

operator= 函数 2

[AUTOSAR defined] not present in ISO-14882. Move assignment operator

重载 = 2
PolymorphicAllocator & operator= (PolymorphicAllocator &&other) noexcept=default; SWS_CORE_00066

类型别名

value_type 类型别名

≙ [mem.poly.allocator.class]

using value_type = Tp;

方法文档

函数 PolymorphicAllocator [SWS_CORE_06541]

PolymorphicAllocator () noexcept;

As per corresponding usage in [mem.poly.allocator.class]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06541
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06541@rel:R25-11#45ca4ee3
Content hash
45ca4ee3
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06541
Status: valid/unmigrated Version: rel:R25-11#195a35ec Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06541@rel:R25-11#195a35ec
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#7e6fd9e52026-09-30
  • R23-11rel:R23-11#1465b8862026-10-14
  • R24-11rel:R24-11#a1bf01392026-10-14
  • R25-11rel:R25-11#195a35ec2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 PolymorphicAllocator [SWS_CORE_06542]

PolymorphicAllocator (MemoryResource *r) noexcept;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. The function is noexcept

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06542
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06542@rel:R25-11#9a55dd27
Content hash
9a55dd27
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06542
Status: valid/unmigrated Version: rel:R25-11#8bd93278 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06542@rel:R25-11#8bd93278
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#8ff7601b2026-09-30
  • R23-11rel:R23-11#d5a7d6172026-10-14
  • R24-11rel:R24-11#728611b82026-10-14
  • R25-11rel:R25-11#8bd932782026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 PolymorphicAllocator [SWS_CORE_06543]

PolymorphicAllocator (const PolymorphicAllocator &other) noexcept=default;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. The function is noexcept

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06543
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06543@rel:R25-11#c984aa85
Content hash
c984aa85
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06543
Status: valid/unmigrated Version: rel:R25-11#5d62e6ca Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06543@rel:R25-11#5d62e6ca
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#50677d202026-09-30
  • R23-11rel:R23-11#fc99e5522026-10-14
  • R24-11rel:R24-11#7f7cdd4b2026-10-14
  • R25-11rel:R25-11#5d62e6ca2026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 PolymorphicAllocator [SWS_CORE_06544]

template <class U> PolymorphicAllocator (const PolymorphicAllocator< U > &other) noexcept;

As per corresponding usage in [mem.poly.allocator.class]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06544
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06544@rel:R25-11#9625e385
Content hash
9625e385
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06544
Status: valid/unmigrated Version: rel:R25-11#539ac7f5 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06544@rel:R25-11#539ac7f5
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#1facdd412026-09-30
  • R23-11rel:R23-11#a331d77c2026-10-14
  • R24-11rel:R24-11#745d118b2026-10-14
  • R25-11rel:R25-11#539ac7f52026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 PolymorphicAllocator [SWS_CORE_06546] Upstream: RS_AP_00145

PolymorphicAllocator (PolymorphicAllocator &&other) noexcept;

[AUTOSAR defined] not present in ISO-14882. Move constructor

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Parameter (in)

ParameterBeschreibung
otherother PolymorphicAllocator to move from

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06546
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06546@rel:R25-11#74db72f3
Content hash
74db72f3
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06546
Status: valid/unmigrated Version: rel:R25-11#8cbb6f43 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06546@rel:R25-11#8cbb6f43
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#cbffc4452026-09-30
  • R23-11rel:R23-11#76904a592026-10-14
  • R24-11rel:R24-11#fb6303702026-10-14
  • R25-11rel:R25-11#8cbb6f432026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 allocate [SWS_CORE_06547]

[[nodiscard]] Tp * allocate (std::size_t n) noexcept;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. The function is noexcept 2. If unsuccessful: nullptr is returned, instead of raising any Exception

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: e24ff27c5b25 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::PolymorphicAllocator 的成员函数 allocate 用于为 n 个类型为 Tp 的对象同步请求未初始化的内存 [SWS_CORE_06547]。它参考了 [mem.poly.allocator.class] 的功能,但通过声明为 noexcept 和属性 [[nodiscard]] 特意偏离了 C++ 标准 [SWS_CORE_06547]。

在出错时,allocate 不会抛出诸如 std::bad_alloc 之类的异常,而是返回一个 nullptr [SWS_CORE_06547]。由于 [[nodiscard]] 的存在,调用者在必须显式接收返回值并在使用该内存区域之前检查 nullptr [SWS_CORE_06547]。关于并发性,该函数被归类为 Exception-Safe,但被视为非线程安全(not thread-safe)[SWS_CORE_06547]。解释:因此,从不同线程通过同一分配器进行同步调用可能需要调用者进行外部保护。 问题 Q-b00116faadf930fe (未决)

这种无异常的容错行为直接对应于接口 ara::core::MemoryResource::allocate [SWS_CORE_06503],后者同样被定义为 noexcept 并在出错时返回 nullptr。预定义的实例(如 NullMemoryResource [SWS_CORE_06563])也采用该原则,并在分配调用时一贯返回 nullptr。在更高层面上,该机制与诸如 ara::core::Vector [SWS_CORE_01315] 之类的容器进行交互,其赋值运算符根据此类分配特性进行了调整。

该文本为自动生成。以 AUTOSAR 规范为准。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Rückgabewert

TypBeschreibung
Tp *• If successful: As per corresponding usage in [mem.poly.allocator.class] • If unsuccessful: the returned pointer shall be nullptr

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06547
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06547@rel:R25-11#897fc314
Content hash
897fc314
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06547
Status: valid/unmigrated Version: rel:R25-11#c37fff24 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06547@rel:R25-11#c37fff24
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#1a6944692026-09-30
  • R23-11rel:R23-11#eca29eb82026-10-14
  • R24-11rel:R24-11#ae9311ae2026-10-14
  • R25-11rel:R25-11#c37fff242026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 allocate_bytes [SWS_CORE_06549]

[[nodiscard]] void * allocate_bytes (std::size_t nbytes, std::size_t alignment=alignof(std::max_align_t)) noexcept;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. The function is noexcept 2. If unsuccessful: the returned pointer shall be nullptr

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: ed713f104c1d 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

类 ara::core::PolymorphicAllocator 的成员函数 allocate_bytes 以指定的对齐方式 alignment 保留大小为 nbytes 的原始内存 [SWS_CORE_06549]。对齐方式的默认值对应于 alignof(std::max_align_t) [SWS_CORE_06549]。该函数通过头文件 ara/core/memory_resource.h 引入并同步执行 [SWS_CORE_06549]。

错误处理与语义

与遵循 [mem.poly.allocator.class] 的标准行为不同,该实现表现出两项偏差 [SWS_CORE_06549]:

  • 该函数被声明为 noexcept 且不抛出异常 [SWS_CORE_06549]。
  • 如果分配失败,函数将返回 nullptr,而不是触发异常 [SWS_CORE_06549]。

由于属性 [[nodiscard]],调用方必须评估返回值,特别是在访问内存区域之前检查 nullptr [SWS_CORE_06549]。

并发性与限制

关于线程安全性,该方法被指定为 not thread-safe [SWS_CORE_06549]。因此,在同一实例上的并行调用推测需要外部同步 [SWS_CORE_06549]。 问题 Q-85c74d55563cae38 (未决)关于异常安全性,该操作被视为 exception safe [SWS_CORE_06549]。

该文本由人工智能基于规范生成。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06549
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06549@rel:R25-11#5aa055a2
Content hash
5aa055a2
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06549
Status: valid/unmigrated Version: rel:R25-11#126a0b29 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06549@rel:R25-11#126a0b29
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#d65ae27d2026-09-30
  • R23-11rel:R23-11#d9ed47762026-10-14
  • R24-11rel:R24-11#9b3f93072026-10-14
  • R25-11rel:R25-11#126a0b292026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 allocate_object [SWS_CORE_06551]

template <class T> [[nodiscard]] T * allocate_object (std::size_t n=1) noexcept;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. The function is noexcept 2. If unsuccessful: the returned pointer shall be nullptr

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: c04a4d5d02ff 来源 未决问题(2)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

模板成员函数 allocate_object 是类 ara::core::PolymorphicAllocator 的组成部分,并通过头文件 #include "ara/core/memory_resource.h" 提供 [SWS_CORE_06551]。它同步为 n 个类型为 T 的对象分配内存,其中参数 n 默认设置为值 1 [SWS_CORE_06551]。编译器属性 [[nodiscard]] 强制调用方不得忽略返回的有类型指针 T*。

错误处理

规范定义了相对于标准 [mem.poly.allocator.class] 的两项显式偏差 [SWS_CORE_06551]:

  • 无异常:该函数被声明为 noexcept 并被指定为异常安全(exception safe)[SWS_CORE_06551]。
  • 错误时返回空指针:如果内存分配失败,不会抛出异常,而是强制返回 nullptr [SWS_CORE_06551]。

因此,调用方必须在进一步使用之前立即检查返回的指针是否为 nullptr。

并发性与限制

该操作被指定为非线程安全(not thread-safe)[SWS_CORE_06551]。并发使用同一分配器实例时,推测可能需要外部同步以避免数据竞争。此外,该函数仅保留纯内存(解释:在保留的内存中构造对象由后续机制负责)。 问题 Q-c41df2caaeb4c503 (未决)

本文档由 AI 生成,基于 AUTOSAR R25-11 规范。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06551
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06551@rel:R25-11#2e833994
Content hash
2e833994
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06551
Status: valid/unmigrated Version: rel:R25-11#e1e4da70 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06551@rel:R25-11#e1e4da70
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#3b58128a2026-09-30
  • R23-11rel:R23-11#68fdb6af2026-10-14
  • R24-11rel:R24-11#e6cdc1b02026-10-14
  • R25-11rel:R25-11#e1e4da702026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 construct [SWS_CORE_06555]

template <class T, class... Args> void construct (T *p, Args &&... args) noexcept(std::is_nothrow_ constructible< T, Args... >::value);

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. Function is conditionally noexcept

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: b824902bd6dd 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::PolymorphicAllocator([SWS_CORE_06555])的模板函数 construct 用于在所传递的内存地址 p 处同步创建类型为 T 的对象,同时转发参数 args...。它通过头文件 ara/core/memory_resource.h 定义,且大体遵循 [mem.poly.allocator.class] 中的规定。

与 C++ 标准的一项显式偏差涉及异常处理:根据 [SWS_CORE_06555],该函数根据 std::is_nothrow_constructible<T, Args...>::value 是否成立而被有条件地声明为 noexcept。规范据此赋予其 conditionally exception safe 属性。解读:只要 T 无法无异常构造,任何构造函数异常都可能会不受阻碍地传播给调用方,因为未定义内部错误码或单独的捕获机制。 问题 Q-ad77510f396e59ae (未决)

关于并发性和约束条件,construct 被指定为非线程安全(not thread-safe)([SWS_CORE_06555])。因此,在对同一分配器实例或同一内存区域进行并发访问时,调用上下文中必须进行外部同步。

依赖于类型的 noexcept 声明架构模式符合 ara::core 中的约定,该约定也用于 ara::core::Result 的构造函数等([SWS_CORE_00725]、[SWS_CORE_00726])。

本使用说明系自动生成,并仅基于 AUTOSAR Adaptive Release R25-11 规范。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitconditionally exception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06555
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06555@rel:R25-11#193fb23c
Content hash
193fb23c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06555
Status: valid/unmigrated Version: rel:R25-11#0973fb97 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06555@rel:R25-11#0973fb97
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#797687e32026-09-30
  • R23-11rel:R23-11#62b249762026-10-14
  • R24-11rel:R24-11#44e873a92026-10-14
  • R25-11rel:R25-11#0973fb972026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 deallocate [SWS_CORE_06548]

void deallocate (Tp *p, std::size_t n) noexcept;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. The function is noexcept 2. If unsuccessful: errors will be silently ignored

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 2c2725501203 来源
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

类 ara::core::PolymorphicAllocator 的成员函数 deallocate 从地址 p 开始释放先前为 n 个类型为 Tp 的对象分配的内存 [SWS_CORE_06548]。通过头文件 ara/core/memory_resource.h 进行声明 [SWS_CORE_06548]。该函数原则上遵循 [mem.poly.allocator.class] 规定的标准 C++ 分配器语义,但存在两处特定差异 [SWS_CORE_06548]。

错误处理与异常安全性

作为主要差异,该操作被声明为 noexcept 并被指定为具有异常安全性(exception safe)[SWS_CORE_06548]。如果释放内存失败,发生的错误将被静默忽略(silently ignored),因此既不会抛出异常,也不会返回显式错误代码 [SWS_CORE_06548]。

并发性与交互

关于调用上下文,deallocate 被归类为非线程安全(not thread-safe)[SWS_CORE_06548]。在内存管理概念中,该函数对应于底层基类 ara::core::MemoryResource 的方法 deallocate [SWS_CORE_06504],针对该基类同样适用关于 noexcept 和静默错误处理的相同差异。

本使用说明为自动创建,且完全基于 AUTOSAR Adaptive 的规范要求。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06548
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06548@rel:R25-11#9747d837
Content hash
9747d837
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06548
Status: valid/unmigrated Version: rel:R25-11#d1d0b454 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06548@rel:R25-11#d1d0b454
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#824b5be32026-09-30
  • R23-11rel:R23-11#af3c4e332026-10-14
  • R24-11rel:R24-11#92f9b2332026-10-14
  • R25-11rel:R25-11#d1d0b4542026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 deallocate_bytes [SWS_CORE_06550]

void deallocate_bytes (void *p, std::size_t nbytes, std::size_t alignment=alignof(std::max_align_t)) noexcept;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. The function is noexcept 2. If unsuccessful: errors will be silently ignored

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: faf22ebd97f2 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::PolymorphicAllocator 的函数 deallocate_bytes 用于根据 [SWS_CORE_06550] 释放先前分配的内存区域。它通过头文件 ara/core/memory_resource.h 提供,并原则上基于 [mem.poly.allocator.class] 中的语义。

调用以同步方式进行,并根据 [SWS_CORE_06550] 期望以下参数:

  • p:指向待释放内存区域的指针(void*)。
  • nbytes:待释放内存的大小(以字节为单位)(std::size_t)。
  • alignment:期望的对齐方式(默认值 alignof(std::max_align_t))。

关于错误行为,该实现表现出相对于标准的特定偏差:该函数被声明为 noexcept 并被视为异常安全(exception safe)。如果释放失败,根据 [SWS_CORE_06550],发生的错误将被静默忽略(silently ignored)。不抛出异常,也不提供返回值。

关于并发性和限制,该函数被显式指定为非线程安全(not thread-safe)[SWS_CORE_06550]。因此,在没有外部同步的情况下对同一分配器实例进行并发访问推测会导致未定义行为。 问题 Q-33c80e3bb50ed64f (未决)

本使用说明基于 Release R25-11 自动生成。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06550
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06550@rel:R25-11#114080f6
Content hash
114080f6
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06550
Status: valid/unmigrated Version: rel:R25-11#7305c652 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06550@rel:R25-11#7305c652
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#b90edcee2026-09-30
  • R23-11rel:R23-11#9a13c45b2026-10-14
  • R24-11rel:R24-11#eeb59aac2026-10-14
  • R25-11rel:R25-11#7305c6522026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 deallocate_object [SWS_CORE_06552]

template <class T> void deallocate_object (T *p, std::size_t n=1) noexcept;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. Function is nullptr 2. If unsuccessful: errors will be silently ignored

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: d1e41bdb2142 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::PolymorphicAllocator 的模板函数 deallocate_object 用于释放先前保留的对象内存 [SWS_CORE_06552]。它参考了符合 [mem.poly.allocator.class] 的相应 C++ 标准用法,但存在特定偏差 [SWS_CORE_06552]。

关于参数和调用上下文,适用以下属性 [SWS_CORE_06552]:

  • 签名:template <class T> void deallocate_object (T *p, std::size_t n=1) noexcept; [SWS_CORE_06552]。
  • 头文件:该函数可通过 #include "ara/core/memory_resource.h" 获取 [SWS_CORE_06552]。
  • 返回值:该操作不返回任何返回值(void)[SWS_CORE_06552]。
  • 空指针行为:作为显式偏差,规范规定当传入 nullptr 时该函数生效或支持空指针(“Function is nullptr”)[SWS_CORE_06552]。

关于错误处理,该函数被声明为 noexcept 并被视为异常安全(exception safe)[SWS_CORE_06552]。如果解除分配失败,发生的错误将被静默忽略(“errors will be silently ignored”),从而不会向外传播任何异常 [SWS_CORE_06552]。

作为一项主要限制,deallocate_object被归类为非线程安全(not thread-safe)[SWS_CORE_06552]。因此,在从多个线程对同一分配器实例进行并发访问时,必须通过外部同步机制来保护调用。

本文字由 AI 创建,且完全基于版本 R25-11 的规范。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06552
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06552@rel:R25-11#629fad43
Content hash
629fad43
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06552
Status: valid/unmigrated Version: rel:R25-11#8e127a90 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06552@rel:R25-11#8e127a90
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#97b0add92026-09-30
  • R23-11rel:R23-11#0e144f892026-10-14
  • R24-11rel:R24-11#30aa2ab62026-10-14
  • R25-11rel:R25-11#8e127a902026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 delete_object [SWS_CORE_06554]

template <class T> void delete_object (T *p) noexcept(std::is_nothrow_destructible< T >::value);

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. Function is conditionally noexcept 2. If unsuccessful: errors will be silently ignored

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: c42857d5d063 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

根据 [SWS_CORE_06554],类 ara::core::PolymorphicAllocator 的成员函数 delete_object 用于销毁并释放由所传递指针 p 指向的 T 类型对象。该函数通过头文件 #include "ara/core/memory_resource.h" 提供,并遵循 [mem.poly.allocator.class] 中的行为,但存在特定偏差。

关于调用上下文和语义,适用以下特性:

  • 返回值与异常:该函数没有返回值(void)。它具有条件异常安全性(conditionally noexcept),规范为 noexcept(std::is_nothrow_destructible<T>::value),即只要 T 的析构函数声明为不抛出异常,它就不会抛出任何异常 [SWS_CORE_06554]。
  • 错误处理:如果操作失败,发生的错误将被静默忽略(errors will be silently ignored)[SWS_CORE_06554]。解读:因此,调用方在发生错误时既不会收到错误消息,也不会收到错误码或异常。 问题 Q-9393b0f68a055e4b (未决)
  • 线程安全性:该操作被指定为非线程安全(not thread-safe)[SWS_CORE_06554]。跨多个线程并发使用同一分配器时,同步由调用方负责。

该文本由 AI 基于规范 R25-11 生成。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitconditionally exception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06554
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06554@rel:R25-11#3a158a91
Content hash
3a158a91
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06554
Status: valid/unmigrated Version: rel:R25-11#9b4d40a0 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06554@rel:R25-11#9b4d40a0
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#052ca7492026-09-30
  • R23-11rel:R23-11#3c9cbc572026-10-14
  • R24-11rel:R24-11#d8a2d49d2026-10-14
  • R25-11rel:R25-11#9b4d40a02026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 destroy [SWS_CORE_06556]

template <class T> void destroy (T *p) noexcept(std::is_nothrow_destructible< T >::value);

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. Function is conditionally noexcept

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: d8b5334c8292 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

类 ara::core::PolymorphicAllocator([SWS_CORE_06556])的模板成员函数 destroy 用于析构指针 p 所指向的 T 类型对象。该函数在头文件 ara/core/memory_resource.h 中声明,并基本遵循 [mem.poly.allocator.class]([SWS_CORE_06556])中的标准化行为。该方法调用不返回任何值,并在调用线程的上下文中同步执行。解读:此处应当假定 p 指向一个先前已实例化的有效对象。 问题 Q-a4faf7034eb683dd (未决)

错误处理与异常安全性

关于错误处理,该函数被归类为有条件异常安全(conditionally exception safe)([SWS_CORE_06556])。作为与标准要求 [mem.poly.allocator.class] 的特定偏差,destroy 被有条件地声明为 noexcept(std::is_nothrow_destructible<T>::value)([SWS_CORE_06556])。只要所传递类型 T 的析构函数不抛出异常,无异常性便适用于整个调用;否则,析构函数产生的异常可能会逃逸。

并发性与限制

关于并发行为,destroy 被指定为非线程安全(not thread-safe)([SWS_CORE_06556])。当多个线程同时访问 ara::core::PolymorphicAllocator 的同一实例或要销毁的对象时,必须建立适当的外部同步机制。

本使用说明系基于 AUTOSAR Adaptive Release R25-11 规范自动生成。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitconditionally exception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06556
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06556@rel:R25-11#2aeebcc3
Content hash
2aeebcc3
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06556
Status: valid/unmigrated Version: rel:R25-11#abadf693 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06556@rel:R25-11#abadf693
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#b20f3b522026-09-30
  • R23-11rel:R23-11#4cffca7a2026-10-14
  • R24-11rel:R24-11#c0cdac192026-10-14
  • R25-11rel:R25-11#abadf6932026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 new_object [SWS_CORE_06553]

template <class T, class... CtorArgs> [[nodiscard]] T * new_object (CtorArgs &&... ctor_args) noexcept(std::is_nothrow_constructible< T, CtorArgs... >::value);

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. Function is conditionally noexcept 2. If unsuccessful: nullptr is returned, instead of raising any Exception

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: d4720bb5fd75 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

类 ara::core::PolymorphicAllocator(定义于 #include "ara/core/memory_resource.h" 中)的模板成员函数 new_object 同步分配内存,并使用传入的构造函数参数 ctor_args 构造类型为 T 的对象 [SWS_CORE_06553]。

使用受以下规定以及与标准 [mem.poly.allocator.class] 的偏差约束 [SWS_CORE_06553]:

  • 调用与返回值:对象创建成功后,将返回指向新实例的有类型指针 T*。属性 [[nodiscard]] 强制调用方评估该返回值。
  • 错误处理:与 [mem.poly.allocator.class] 不同,在失败情况下不会抛出异常,而是返回 nullptr。因此,调用方在访问之前必须严格检查生成的指针是否为 nullptr。
  • 异常安全性:该函数被指定为有条件异常安全(conditionally exception safe)。当且仅当对象创建本身保证不抛出异常时(noexcept(std::is_nothrow_constructible<T, CtorArgs...>::value)),它才是 noexcept。
  • 并发性:该函数被声明为非线程安全(not thread-safe)。解读:当并发访问 ara::core::PolymorphicAllocator 的同一实例时,调用方应当负责适当的外部同步。 问题 Q-3d0ecfe34187c91e (未决)

本使用说明基于 AUTOSAR R25-11 自动生成。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitconditionally exception safe
Thread-Sicherheitnot thread-safe

Rückgabewert

TypBeschreibung
T*• If successful: As per corresponding usage in [mem.poly.allocator.class] • If unsuccessful: the returned pointer shall be nullptr

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06553
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06553@rel:R25-11#52dfb0d3
Content hash
52dfb0d3
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06553
Status: valid/unmigrated Version: rel:R25-11#a6ad2786 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06553@rel:R25-11#a6ad2786
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#d2723bd62026-09-30
  • R23-11rel:R23-11#914b6df22026-10-14
  • R24-11rel:R24-11#700266922026-10-14
  • R25-11rel:R25-11#a6ad27862026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 operator= [SWS_CORE_00066] Upstream: RS_AP_00145

PolymorphicAllocator & operator= (PolymorphicAllocator &&other) noexcept=default;

[AUTOSAR defined] not present in ISO-14882. Move assignment operator

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe

Parameter (in)

ParameterBeschreibung
otherother PolymorphicAllocator to move from

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_00066
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_00066@rel:R25-11#38acdc59
Content hash
38acdc59
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_00066
Status: valid/unmigrated Version: rel:R25-11#b0c562e4 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_00066@rel:R25-11#b0c562e4
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#9ab9307f2026-09-30
  • R24-11rel:R24-11#49e75ee42026-10-14
  • R25-11rel:R25-11#b0c562e42026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 operator= [SWS_CORE_06545]

PolymorphicAllocator & operator= (const PolymorphicAllocator &)=delete;

As per corresponding usage in [mem.poly.allocator.class]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06545
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06545@rel:R25-11#8a142de1
Content hash
8a142de1
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06545
Status: valid/unmigrated Version: rel:R25-11#ebba2fe5 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06545@rel:R25-11#ebba2fe5
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#6662d26d2026-09-30
  • R23-11rel:R23-11#19b7dc922026-10-14
  • R24-11rel:R24-11#9e9fa6da2026-10-14
  • R25-11rel:R25-11#ebba2fe52026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 resource [SWS_CORE_06557]

MemoryResource * resource () const noexcept;

As per corresponding usage in [mem.poly.allocator.class]

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 90f4d7f53a57 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

方法 resource 是来自头文件 #include "ara/core/memory_resource.h" 的类 ara::core::PolymorphicAllocator 的常量成员函数 [SWS_CORE_06557]。根据对 [mem.poly.allocator.class] 的规范引用,它用于同步检索关联的内存资源 [SWS_CORE_06557]。

使用与签名

函数签名是 MemoryResource * resource () const noexcept; [SWS_CORE_06557]。该调用无参数且在 ara::core::PolymorphicAllocator 的实例上同步执行。作为返回值,该函数提供一个类型为 MemoryResource* 的指针 [SWS_CORE_06557]。解读:返回的指针应当直接指向分配器用于内存操作的具体内存资源。 问题 Q-392683a38a4e490b (未决)

错误处理与并发

  • 异常安全性:该函数被声明为 noexcept 并被归类为 exception safe [SWS_CORE_06557]。它不抛出异常,并且未定义特定的错误码。
  • 线程安全性:规范明确将该方法指定为 thread-safe [SWS_CORE_06557]。通过限定为 const,跨多个线程的并发读取访问是安全的。

相互作用

在模块 core 中,resource 提供了用于查询由 ara::core::PolymorphicAllocator 封装的 MemoryResource 并调用其操作的接口 [SWS_CORE_06557]。

本使用说明由 AI 基于 AUTOSAR Adaptive R25-11 规范生成。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitthread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06557
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06557@rel:R25-11#dcb27cd5
Content hash
dcb27cd5
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06557
Status: valid/unmigrated Version: rel:R25-11#95a9a731 Versionshistorie & Revisions (1 transition, 4 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06557@rel:R25-11#95a9a731
Point-in-Time History:
Recorded Revisions (4):
  • R25-11rel:R25-11#03dbf6b12026-09-30
  • R23-11rel:R23-11#071c0a122026-10-14
  • R24-11rel:R24-11#4d44fc3f2026-10-14
  • R25-11rel:R25-11#95a9a7312026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

函数 select_on_container_copy_construction [SWS_CORE_06573]

PolymorphicAllocator select_on_container_copy_construction () const noexcept;

As per corresponding usage in [mem.poly.allocator.class] except for the following deviations: 1. The function is noexcept

AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: c103d893236c 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

使用

成员函数 select_on_container_copy_construction 属于类 ara::core::PolymorphicAllocator 的作用域,并通过头文件 #include "ara/core/memory_resource.h" 声明([SWS_CORE_06573])。它被同步调用,以便在容器的复制构造过程中创建 PolymorphicAllocator 的新实例([SWS_CORE_06573])。功能行为遵循规范 [mem.poly.allocator.class]([SWS_CORE_06573])。解读:生成的分配器应当是默认构造的,因此会使用默认内存资源,而不是强制复制源容器的内存资源。 问题 Q-134ed967dc22e133 (未决)

错误处理与异常安全性

与通用 C++ 规范的核心偏差在于,该函数在 AUTOSAR 中被显式声明为 noexcept([SWS_CORE_06573])。其执行被定义为异常安全(exception safe)([SWS_CORE_06573])。该接口未设置用于指示错误的特定错误码、返回值,亦未设置发送至 DET 或 DEM 的消息,因为调用保证无差错终止。

并发性与限制

根据规范,该函数被归类为 not thread-safe([SWS_CORE_06573])。这意味着在没有外部同步的情况下,从多个线程对同一 PolymorphicAllocator 实例的同时调用可能会导致数据争用。在并发环境中复制容器之前,用户必须保护对分配器对象的访问。

本使用说明系根据 Release R25-11 的 AUTOSAR 规范自动创建。

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Exception-Sicherheitexception safe
Thread-Sicherheitnot thread-safe

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06573
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06573@rel:R25-11#d69bd75b
Content hash
d69bd75b
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06573
Status: valid/unmigrated Version: rel:R25-11#23e4ce94 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06573@rel:R25-11#23e4ce94
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#f78e279c2026-09-30
  • R24-11rel:R24-11#70871b2b2026-10-14
  • R25-11rel:R25-11#23e4ce942026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill

类型别名文档

类型别名 value_type [SWS_CORE_06572]

using value_type = Tp;

As per corresponding usage in [mem.poly.allocator.class]

Header-Datei#include "ara/core/memory_resource.h"
Scopeclass ara::core::PolymorphicAllocator
Symbolvalue_type

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_CORE_06572
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_06572@rel:R25-11#ce1179e8
Content hash
ce1179e8
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_06572
Status: valid/unmigrated Version: rel:R25-11#8c0c50c3 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_CORE_06572@rel:R25-11#8c0c50c3
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#2bb07c522026-09-30
  • R24-11rel:R24-11#92a2e3f52026-10-14
  • R25-11rel:R25-11#8c0c50c32026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill