DEENESPTFRRUARHIKOZHNL

类 ara::core::Optional

[SWS_CORE_01033]

template <typename T> class Optional final {...};

Implementation of std::optional<T> type from [optional.syn]

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

用户指南人工智能生成

在栈内存中类型安全地封装可选值,并支持基于状态的访问。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: b7fd51442c86 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

在栈内存中类型安全地封装可选值,并支持基于状态的访问。

类 ara::core::Optional 提供了 std::optional<T> 的标准兼容实现,以便在栈中类型安全且无分配地封装 value_type 类型的值 [SWS_CORE_01102]。应用程序通过 has_value() [SWS_CORE_01129] 检查占用状态,并通过 value() 或运算符访问内容。必须严格避免访问空实例,因为尽管声明为 noexcept,它仍会触发平台违规 IsoStdBadOptionalAccessViolation [SWS_CORE_01131]。

上下文

类 ara::core::Optional 为 Adaptive Platform 提供了容器 std::optional<T> 的标准兼容实现。它用作类型安全的包装器,用于封装 value_type 类型的可选值 [SWS_CORE_01102]。通过使用它,不再需要容易出错的哨兵值、特殊错误标志或动态内存分配(例如空指针)来指示缺失的数据。对象的存储直接在实例自身的栈内存中进行,从而在 AUTOSAR 运行时环境中确保了确定性的资源管理和缓存局部性。

生命周期

ara::core::Optional 的实例在任何时刻都处于两个离散状态之一:未初始化(空)或包含 T 类型的值。空的初始状态通过默认构造函数 [SWS_CORE_01103] 或显式使用 nullopt_t [SWS_CORE_01104] 进行初始化来进入。使用具体值的初始化可以通过拷贝和移动构造函数 [SWS_CORE_01105]、[SWS_CORE_01106]、[SWS_CORE_01109]、类型转换构造函数 [SWS_CORE_01110]、[SWS_CORE_01111],或直接通过 in_place_t [SWS_CORE_01107]、[SWS_CORE_01108] 原位进行,从而完全避免了临时拷贝。

在运行过程中,状态可以多次切换:方法 emplace 直接在对象的存储中构造新值,并丢弃可能先前存在的状态 [SWS_CORE_01119]、[SWS_CORE_01120]。同样,通过引用限定符 & 严格绑定到左值的赋值运算符也会进入占用状态 [SWS_CORE_01114]、[SWS_CORE_01115]、[SWS_CORE_01116]、[SWS_CORE_01117]、[SWS_CORE_01118]。重置为空状态通过 reset() [SWS_CORE_01136] 或通过赋值 nullopt_t [SWS_CORE_01113] 确定性地执行。此外,两个实例可以通过 swap 高效地交换它们的状态和数据内容 [SWS_CORE_01121]。到达生命周期终点时,析构函数会销毁可能包含的对象;其 noexcept 保证直接与类型 T 的可析构性绑定 [SWS_CORE_01112]。

optional_lifecycle Init Leer Leer Init->Leer Optional() / nullopt Belegt Belegt Init->Belegt Optional(Wert) / in_place Leer->Belegt emplace() / operator= Ende Ende Leer->Ende ~Optional() Belegt->Leer reset() / operator=(nullopt) Belegt->Belegt emplace() / operator= Belegt->Ende ~Optional()

状态图:ara::core::Optional 实例的生命周期与状态转换。来源:[SWS_CORE_01103]、[SWS_CORE_01104]、[SWS_CORE_01107]、[SWS_CORE_01113]、[SWS_CORE_01119]、[SWS_CORE_01136]、[SWS_CORE_01112]

使用路径

常规流程包括验证占用状态并随后读取值。用于状态查询的有 has_value() [SWS_CORE_01129] 和显式转换运算符 operator bool [SWS_CORE_01128]。

如果存在值,则可以通过解引用运算符 operator*([SWS_CORE_01124]、[SWS_CORE_01125]、[SWS_CORE_01126]、[SWS_CORE_01127])或 operator->([SWS_CORE_01122]、[SWS_CORE_01123])访问该值。此外,方法 value() 允许对左值和右值进行受限定的访问([SWS_CORE_01130]、[SWS_CORE_01131]、[SWS_CORE_01132]、[SWS_CORE_01133])。若在未被占用时需要使用预定义的回退值,value_or 提供了直接的备选策略([SWS_CORE_01134]、[SWS_CORE_01135])。处理完成后,容器可根据需要通过 reset() 进行清理 [SWS_CORE_01136]。

检查并访问可选值应用Optionalhas_value()boolalthas_value() == truevalue()const T&has_value() == falsevalue_or(fallback)Treset()void

时序图:状态检查与值提取的流程。来源:[SWS_CORE_01128]、[SWS_CORE_01129]、[SWS_CORE_01131]、[SWS_CORE_01134]、[SWS_CORE_01136]

错误场景

当解引用空实例或越权请求其值时,即发生错误访问。访问方法 value()、operator* 和 operator-> 在 AUTOSAR Adaptive 中声明为 noexcept,但在空状态下会触发违规 IsoStdBadOptionalAccessViolation([SWS_CORE_01122]、[SWS_CORE_01123]、[SWS_CORE_01124]、[SWS_CORE_01125]、[SWS_CORE_01126]、[SWS_CORE_01127]、[SWS_CORE_01130]、[SWS_CORE_01131]、[SWS_CORE_01132]、[SWS_CORE_01133])。解释:由于这些方法被声明为 noexcept,触发 IsoStdBadOptionalAccessViolation 应该不会作为可捕获的标准异常进行传播,而是推测会通过平台特定的违规机制导致程序立即终止。 问题 Q-3c066dae2b93a9ec (未决)因此,调用方在读取之前必须强制验证占用状态。

另一个错误场景涉及类型构造时的异常处理:构造函数、赋值运算符、swap 和 emplace 具有条件 noexcept 说明符,这些说明符取决于 T 的相应类型操作本身是否被声明为 noexcept([SWS_CORE_01105]、[SWS_CORE_01114]、[SWS_CORE_01119]、[SWS_CORE_01121])。回退方法 value_or 还被明确标识为非异常安全(“not exception safe”)([SWS_CORE_01134]、[SWS_CORE_01135]),以便在生成返回值时发生的错误能传递给调用方。

本类指南仅基于 AUTOSAR Adaptive R25-11 中 ara::core::Optional 规范的要求。

成员图

类图

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

G nara__core__Optional627 Optional + Optional() + operator=() + ~Optional() + emplace() + reset() + swap() + has_value() + operator bool() + operator*() + operator->() + value() + value_or()

详细视图

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

构造函数和析构函数

Optional 函数 9

≙ [optional]

重载 Optional 9
constexpr Optional () noexcept; SWS_CORE_01103
constexpr Optional (nullopt_t) noexcept; SWS_CORE_01104
constexpr Optional (const Optional &other) noexcept(std::is_nothrow_ copy_constructible< T >::value); SWS_CORE_01105
constexpr Optional (Optional &&other) noexcept(std::is_nothrow_move_ constructible< T >::value); SWS_CORE_01106
template <typename... Args> explicit constexpr Optional (in_place_t, Args &&...) noexcept(std::is_nothrow_constructible< T, Args... >::value); SWS_CORE_01107
template <typename U, typename... Args> explicit constexpr Optional (in_place_t, std::initializer_list< U >, Args &&...) noexcept(std::is_nothrow_constructible< T, std::initializer_list< U > &, Args &&... >::value); SWS_CORE_01108
template <typename U = T> {<cond-explicit-1>} constexpr Optional (U &&) noexcept(std::is_ nothrow_constructible< T, U >::value); SWS_CORE_01109
template <typename U> {<cond-explicit-2>} Optional (const Optional< U > &) noexcept(std::is_ nothrow_constructible< T, const U & >::value); SWS_CORE_01110
template <typename U> {<cond-explicit-3>} Optional (Optional< U > &&) noexcept(std::is_ nothrow_constructible< T, U >::value); SWS_CORE_01111
~Optional 函数

except for the following deviations: 1. Function is conditionally noexcept ≙ [optional]

~Optional () noexcept(std::is_nothrow_destructible< T >::value);

方法

emplace 函数 2

except for the following deviations: 1. Function is conditionally noexcept ≙ [optional]

重载 emplace 2
template <typename... Args> T & emplace (Args &&...) noexcept(std::is_nothrow_constructible< T, Args &&... >::value); SWS_CORE_01119
template <typename U, typename... Args> T & emplace (std::initializer_list< U >, Args &&...) noexcept(std::is_nothrow_constructible< T, std::initializer_list< U > &, Args &&... >::value); SWS_CORE_01120
has_value 函数

≙ [optional]

constexpr bool has_value () const noexcept;
reset 函数

≙ [optional]

void reset () noexcept;
swap 函数

except for the following deviations: 1. Conditions for the conditional exception safety are modified ≙ [optional]

void swap (Optional &) noexcept(std::is_nothrow_move_constructible< T >::value &&std::is_nothrow_move_assignable< T >::value);
value 函数 4

except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition) ≙ [optional]

重载 value 4
constexpr const T & value () const & noexcept; SWS_CORE_01130
constexpr T & value () & noexcept; SWS_CORE_01131
constexpr T && value () &&noexcept; SWS_CORE_01132
constexpr const T && value () const &&noexcept; SWS_CORE_01133
value_or 函数 2

≙ [optional]

重载 value_or 2
template <typename U> constexpr T value_or (U &&) const &; SWS_CORE_01134
template <typename U> constexpr T value_or (U &&) &&; SWS_CORE_01135

运算符

≙ [optional]

explicit constexpr operator bool () const noexcept;
operator* 函数 4

except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition) ≙ [optional]

重载 * 4
constexpr const T & operator* () const & noexcept; SWS_CORE_01124
constexpr T & operator* () & noexcept; SWS_CORE_01125
constexpr T && operator* () &&noexcept; SWS_CORE_01126
constexpr const T && operator* () const &&noexcept; SWS_CORE_01127
operator-> 函数 2

except for the following deviations: 1. The function is noexcept 2. Function is not constexpr 3. A IsoStdBadOptionalAccessViolation may be raised (see condition) ≙ [optional]

重载 -> 2
const T * operator-> () const noexcept; SWS_CORE_01122
T * operator-> () noexcept; SWS_CORE_01123
operator= 函数 6

≙ [optional]

重载 = 6
Optional & operator= (nullopt_t) & noexcept; SWS_CORE_01113
Optional & operator= (const Optional &other) &noexcept(std::is_ nothrow_copy_constructible< T >::value &&std::is_nothrow_copy_ assignable< T >::value); SWS_CORE_01114
template <typename U = T> Optional & operator= (U &&u) &noexcept(std::is_nothrow_constructible< T, U >::value &&std::is_nothrow_assignable< T &, U >::value); SWS_CORE_01116
template <typename U> Optional & operator= (const Optional< U > &) &noexcept(std::is_ nothrow_constructible< T, const U &>::value &&std::is_nothrow_ assignable< T &, const U &>::value); SWS_CORE_01117
template <typename U> Optional & operator= (Optional< U > &&) &noexcept(std::is_nothrow_ constructible< T, U >::value &&std::is_nothrow_assignable< T &, U >::value); SWS_CORE_01118

类型别名

value_type 类型别名

≙ [optional]

using value_type = T;

方法文档

函数 Optional [SWS_CORE_01103]

constexpr Optional () noexcept;

As per corresponding usage in [optional]

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

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

Record
AUTOSAR/AP/record/SWS_CORE_01103
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01103@rel:R25-11#7b30f2fb
Content hash
7b30f2fb
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01103
Status: valid/unmigrated Version: rel:R25-11#8992786d 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_01103@rel:R25-11#8992786d
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#d86867a02026-09-30
  • R24-11rel:R24-11#86df07de2026-10-14
  • R25-11rel:R25-11#8992786d2026-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

函数 Optional [SWS_CORE_01104]

constexpr Optional (nullopt_t) noexcept;

As per corresponding usage in [optional]

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

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

Record
AUTOSAR/AP/record/SWS_CORE_01104
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01104@rel:R25-11#f78b1043
Content hash
f78b1043
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01104
Status: valid/unmigrated Version: rel:R25-11#411bd18e 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_01104@rel:R25-11#411bd18e
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#e84841e92026-09-30
  • R24-11rel:R24-11#43c232942026-10-14
  • R25-11rel:R25-11#411bd18e2026-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

函数 Optional [SWS_CORE_01105]

constexpr Optional (const Optional &other) noexcept(std::is_nothrow_ copy_constructible< T >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01105
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01105@rel:R25-11#a8ad8a8c
Content hash
a8ad8a8c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01105
Status: valid/unmigrated Version: rel:R25-11#85a53092 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_01105@rel:R25-11#85a53092
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#0af1e1792026-09-30
  • R24-11rel:R24-11#2865a5e92026-10-14
  • R25-11rel:R25-11#85a530922026-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

函数 Optional [SWS_CORE_01106]

constexpr Optional (Optional &&other) noexcept(std::is_nothrow_move_ constructible< T >::value);

As per corresponding usage in [optional]

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01106
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01106@rel:R25-11#b35a8f36
Content hash
b35a8f36
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01106
Status: valid/unmigrated Version: rel:R25-11#5420cc51 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_01106@rel:R25-11#5420cc51
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#a9088f022026-09-30
  • R24-11rel:R24-11#ded734802026-10-14
  • R25-11rel:R25-11#5420cc512026-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

函数 Optional [SWS_CORE_01107]

template <typename... Args> explicit constexpr Optional (in_place_t, Args &&...) noexcept(std::is_nothrow_constructible< T, Args... >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01107
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01107@rel:R25-11#1eec0b0a
Content hash
1eec0b0a
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01107
Status: valid/unmigrated Version: rel:R25-11#0d478adc 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_01107@rel:R25-11#0d478adc
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#4f8cb42a2026-09-30
  • R24-11rel:R24-11#d6033a2e2026-10-14
  • R25-11rel:R25-11#0d478adc2026-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

函数 Optional [SWS_CORE_01108]

template <typename U, typename... Args> explicit constexpr Optional (in_place_t, std::initializer_list< U >, Args &&...) noexcept(std::is_nothrow_constructible< T, std::initializer_list< U > &, Args &&... >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01108
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01108@rel:R25-11#b7182d72
Content hash
b7182d72
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01108
Status: valid/unmigrated Version: rel:R25-11#25dbc842 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_01108@rel:R25-11#25dbc842
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#7769d6192026-09-30
  • R24-11rel:R24-11#030018c92026-10-14
  • R25-11rel:R25-11#25dbc8422026-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

函数 Optional [SWS_CORE_01109]

template <typename U = T> {<cond-explicit-1>} constexpr Optional (U &&) noexcept(std::is_ nothrow_constructible< T, U >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

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

使用

类 ara::core::Optional 的构造函数 [SWS_CORE_01109] 通过头文件 #include "ara/core/optional.h" 提供。作为具有签名 template <typename U = T> constexpr Optional(U&&) 的模板构造函数,它用于在将类型为 U&& 的实参转发给包含的值类型 T 的情况下直接初始化可选值([SWS_CORE_01102])。其语义遵循 [optional] 中的规定,但因无异常的显式条件而有所不同:当且仅当满足 std::is_nothrow_constructible<T, U>::value 时,该函数被指定为 noexcept([SWS_CORE_01109])。

错误处理与异常安全性

在异常安全性方面,该调用被归类为 conditionally exception safe([SWS_CORE_01109])。对于此构造函数,不存在特定的 AUTOSAR 错误码以及通过 DET 或 DEM 的报告途径;如果目标类型 T 的构造失败,将传递该类型的相应异常。

协同交互与并发性

该函数与生成空实例的默认构造函数 [SWS_CORE_01103] 和 null 构造函数 [SWS_CORE_01104],以及复制和移动构造函数 [SWS_CORE_01105] 和 [SWS_CORE_01106] 并存。此外,ara::core::Optional 在 ara::core::Result 的错误处理中充当可选返回值的载体,例如通过 Ok()([SWS_CORE_00770])检索值或通过 Err()([SWS_CORE_00772])检索错误时。理解:由于 [SWS_CORE_01109] 中缺乏明确的线程安全承诺,推测仅在源对象 U 受到保护以防止并发修改时,构造函数的并发调用才是安全的。 问题 Q-edf541fe968f3afe (未决)

此使用说明为自动生成。以 AUTOSAR 规范为准。

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01109
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01109@rel:R25-11#6213d72e
Content hash
6213d72e
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01109
Status: valid/unmigrated Version: rel:R25-11#7558e4db 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_01109@rel:R25-11#7558e4db
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#5e482bc62026-09-30
  • R24-11rel:R24-11#8a9b95052026-10-14
  • R25-11rel:R25-11#7558e4db2026-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

函数 Optional [SWS_CORE_01110]

template <typename U> {<cond-explicit-2>} Optional (const Optional< U > &) noexcept(std::is_ nothrow_constructible< T, const U & >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

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

使用

ara::core::Optional 的转换复制构造函数可通过头文件 #include "ara/core/optional.h" 获取 [SWS_CORE_01110]。它用于从现有实例 const Optional<U>& 同步生成 Optional<T>。规范标记 {<cond-explicit-2>} 大概表示只要 T 不能隐式从 const U& 生成,该构造函数就被声明为 explicit。 问题 Q-4a4adc2b59d1fa53 (未决)

错误处理与异常安全性

对于此构造函数,不存在特定的错误码、DET 或 DEM 消息。该函数被归类为有条件异常安全(conditionally exception safe)[SWS_CORE_01110]。通过 noexcept(std::is_nothrow_constructible<T, const U&>::value),仅当目标类型 T 可以从 const U& 构造且不引发异常时,noexcept 保证才会生效 [SWS_CORE_01110]。如果生成目标值失败,异常将原样传播。

并发性与限制

与 Ok() [SWS_CORE_00770] 等其他函数不同,规范并未指明该构造函数的线程安全性。它大概是可重入的,但对源对象 Optional<U> 的并发读或写访问需要外部同步。 问题 Q-a0534498f685f575 (未决)

相互作用

该构造函数补充了 ara::core::Optional 的其他初始化函数,其中包括默认构造函数、null 构造函数和复制构造函数([SWS_CORE_01103]、[SWS_CORE_01104]、[SWS_CORE_01105]、[SWS_CORE_01106])以及交换操作 [SWS_CORE_01096]。此外,该类型与 ara::core::Result 紧密交互,后者的成员函数 Ok() 和 Err() 将值或错误作为 Optional 暴露出来([SWS_CORE_00770]、[SWS_CORE_00772])。

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

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01110
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01110@rel:R25-11#4a12fd00
Content hash
4a12fd00
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01110
Status: valid/unmigrated Version: rel:R25-11#11b08505 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_01110@rel:R25-11#11b08505
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#f7b346cb2026-09-30
  • R24-11rel:R24-11#a18434152026-10-14
  • R25-11rel:R25-11#11b085052026-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

函数 Optional [SWS_CORE_01111]

template <typename U> {<cond-explicit-3>} Optional (Optional< U > &&) noexcept(std::is_ nothrow_constructible< T, U >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

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

模板函数 [SWS_CORE_01111] 提供了来自头文件 #include "ara/core/optional.h" 的类 ara::core::Optional 的转换移动构造函数。它接收一个右值引用 Optional<U>&& 以初始化 Optional<T> 的实例,并遵循 [optional] 的行为,其记录的差异在于具有有条件的 noexcept 规范 [SWS_CORE_01111]。作为一种理解,规范子句 {<cond-explicit-3>} 大概控制转换是隐式还是显式发生,具体取决于类型 T 和 U 的属性。 问题 Q-0b21a6eafb9414d8 (未决)

在错误处理和异常处理方面,该构造函数被归类为有条件异常安全(conditionally exception safe)[SWS_CORE_01111]。当且仅当满足 std::is_nothrow_constructible<T, U>::value 时,执行为 noexcept [SWS_CORE_01111]。否则,在构造所包含值的过程中可能会发生异常并传播给调用方。

在 ara::core::Optional 内部,该函数补充了常规移动构造函数 [SWS_CORE_01106]、复制构造函数 [SWS_CORE_01105] 以及默认构造函数 [SWS_CORE_01103]。此外,该成员与 ara::core::Result(其方法 Ok() 和 Err() 将包含的值或错误作为 ara::core::Optional 返回,如 [SWS_CORE_00770]、[SWS_CORE_00771] 和 [SWS_CORE_00772] 所示)以及辅助函数 swap [SWS_CORE_01096] 紧密交互。

本使用说明是基于规范数据自动生成的。

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01111
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01111@rel:R25-11#6052b0c1
Content hash
6052b0c1
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01111
Status: valid/unmigrated Version: rel:R25-11#9d33a7e6 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_01111@rel:R25-11#9d33a7e6
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#60888d082026-09-30
  • R24-11rel:R24-11#1297b71f2026-10-14
  • R25-11rel:R25-11#9d33a7e62026-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

函数 emplace [SWS_CORE_01119]

template <typename... Args> T & emplace (Args &&...) noexcept(std::is_nothrow_constructible< T, Args &&... >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

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

类 ara::core::Optional 的成员函数 emplace 用于直接在可选对象的存储中创建所包含的类型 T 的值 [SWS_CORE_01119]。调用通过头文件 ara/core/optional.h 同步进行。作为参数,该函数接收可变参数包 Args&&... 并将其转发给类型 T 的构造函数;返回新创建值的左值引用(T&)[SWS_CORE_01119]。

关于异常处理,该函数被归类为条件异常安全(conditionally exception safe),并且具有基于 std::is_nothrow_constructible<T, Args&&...>::value 的条件 noexcept 规范 [SWS_CORE_01119]。如果 T 的构造引发异常,则适用基础类型的异常安全性;仅当构造保证不抛出异常时,noexcept 保证才有效。规范中未预见特定的错误代码、DEM 事件或 DET 消息 [SWS_CORE_01119]。

关于并发性,规范未作说明;解释:在没有外部同步的情况下,多个线程对 ara::core::Optional 的同一实例进行并发写访问可能不是线程安全的。 问题 Q-c11efb3f95001493 (未决)此外,在重新初始化时,先前存在的值可能会被销毁。

在 ara::core::Optional 内部的协作中,存在替代重载:对于初始化列表,提供了带有 std::initializer_list 的变体 [SWS_CORE_01120],而对于引用类型 ara::core::Optional<T&>,定义了专用重载 [SWS_CORE_01164]。模块 core 中用于原位构造的类似 emplace 机制也存在于容器中,例如 ara::core::Vector [SWS_CORE_01366]、ara::core::Map [SWS_CORE_01458] 和 ara::core::Variant [SWS_CORE_01661]、[SWS_CORE_01662]、[SWS_CORE_01663]、[SWS_CORE_01664]。

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

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01119
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01119@rel:R25-11#2a7eb127
Content hash
2a7eb127
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01119
Status: valid/unmigrated Version: rel:R25-11#a1151217 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_01119@rel:R25-11#a1151217
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#957655d82026-09-30
  • R24-11rel:R24-11#fb1be5602026-10-14
  • R25-11rel:R25-11#a11512172026-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

函数 emplace [SWS_CORE_01120]

template <typename U, typename... Args> T & emplace (std::initializer_list< U >, Args &&...) noexcept(std::is_nothrow_constructible< T, std::initializer_list< U > &, Args &&... >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

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

来自 [SWS_CORE_01120] 的成员函数 emplace 用于直接就地(in-place)初始化类型为 ara::core::Optional 的对象所包含的值。它接收一个 std::initializer_list<U> 以及可选参数 Args&&...,并返回对新创建值的引用 T&。

关于错误处理和异常安全性,该函数被指定为条件异常安全(conditionally exception safe)。根据 [SWS_CORE_01120],noexcept 条件完全取决于目标类型 T 是否可以在使用 std::initializer_list<U>& 和转发参数的情况下无异常地构造(std::is_nothrow_constructible)。这明确偏离了标准 [optional] 中的行为。

在核心组件组合中,此重载补充了来自 [SWS_CORE_01119] 的不带初始化列表的泛型就地构造。对于引用特化,还存在通过 [SWS_CORE_01164] 的赋值。解释:正如 [optional] 中的标准对应项通常的情况一样,如果存在先前的值,该值可能会在重新构造之前被销毁。 问题 Q-b8a9274e43f0a0a9 (未决)

此使用说明是自动生成的,基于规范的规定。

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01120
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01120@rel:R25-11#3eb80b42
Content hash
3eb80b42
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01120
Status: valid/unmigrated Version: rel:R25-11#19e525e9 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_01120@rel:R25-11#19e525e9
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#a140351c2026-09-30
  • R24-11rel:R24-11#d59521372026-10-14
  • R25-11rel:R25-11#19e525e92026-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

函数 has_value [SWS_CORE_01129]

constexpr bool has_value () const noexcept;

As per corresponding usage in [optional]

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

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

Record
AUTOSAR/AP/record/SWS_CORE_01129
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01129@rel:R25-11#9c7780e6
Content hash
9c7780e6
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01129
Status: valid/unmigrated Version: rel:R25-11#7383a7bc 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_01129@rel:R25-11#7383a7bc
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#9f849c3e2026-09-30
  • R24-11rel:R24-11#796326bb2026-10-14
  • R25-11rel:R25-11#7383a7bc2026-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 bool [SWS_CORE_01128]

explicit constexpr operator bool () const noexcept;

As per corresponding usage in [optional]

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

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

Record
AUTOSAR/AP/record/SWS_CORE_01128
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01128@rel:R25-11#18a76afe
Content hash
18a76afe
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01128
Status: valid/unmigrated Version: rel:R25-11#cf39bd07 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_01128@rel:R25-11#cf39bd07
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#109a619b2026-09-30
  • R24-11rel:R24-11#b5a26c7d2026-10-14
  • R25-11rel:R25-11#cf39bd072026-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_01124]

constexpr const T & operator* () const & noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01124
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01124@rel:R25-11#c9242b7f
Content hash
c9242b7f
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01124
Status: valid/unmigrated Version: rel:R25-11#6c6d6246 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_01124@rel:R25-11#6c6d6246
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#72e800a62026-09-30
  • R24-11rel:R24-11#6ba741822026-10-14
  • R25-11rel:R25-11#6c6d62462026-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_01125]

constexpr T & operator* () & noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01125
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01125@rel:R25-11#c337d118
Content hash
c337d118
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01125
Status: valid/unmigrated Version: rel:R25-11#bbff2175 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_01125@rel:R25-11#bbff2175
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#50b8d1332026-09-30
  • R24-11rel:R24-11#da1307272026-10-14
  • R25-11rel:R25-11#bbff21752026-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_01126]

constexpr T && operator* () &&noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01126
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01126@rel:R25-11#43bd0b69
Content hash
43bd0b69
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01126
Status: valid/unmigrated Version: rel:R25-11#eb9c6afb 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_01126@rel:R25-11#eb9c6afb
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#e95005072026-09-30
  • R24-11rel:R24-11#6c670b852026-10-14
  • R25-11rel:R25-11#eb9c6afb2026-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_01127]

constexpr const T && operator* () const &&noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01127
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01127@rel:R25-11#166c935f
Content hash
166c935f
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01127
Status: valid/unmigrated Version: rel:R25-11#0c38bfb2 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_01127@rel:R25-11#0c38bfb2
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#930319d52026-09-30
  • R24-11rel:R24-11#d6b67a322026-10-14
  • R25-11rel:R25-11#0c38bfb22026-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_01122]

const T * operator-> () const noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. Function is not constexpr 3. A IsoStdBadOptionalAccessViolation may be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01122
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01122@rel:R25-11#743217b2
Content hash
743217b2
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01122
Status: valid/unmigrated Version: rel:R25-11#a0430001 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_01122@rel:R25-11#a0430001
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#dede9c812026-09-30
  • R24-11rel:R24-11#33bcccf02026-10-14
  • R25-11rel:R25-11#a04300012026-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_01123]

T * operator-> () noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. Function is not constexpr 3. A IsoStdBadOptionalAccessViolation may be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01123
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01123@rel:R25-11#7cf0a5db
Content hash
7cf0a5db
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01123
Status: valid/unmigrated Version: rel:R25-11#e18dd6ba 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_01123@rel:R25-11#e18dd6ba
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#c2d8053b2026-09-30
  • R24-11rel:R24-11#1d6944b82026-10-14
  • R25-11rel:R25-11#e18dd6ba2026-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_01113]

Optional & operator= (nullopt_t) & noexcept;

As per corresponding usage in [optional]

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

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

Record
AUTOSAR/AP/record/SWS_CORE_01113
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01113@rel:R25-11#c222854c
Content hash
c222854c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01113
Status: valid/unmigrated Version: rel:R25-11#18fcf54f 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_01113@rel:R25-11#18fcf54f
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#f26400562026-09-30
  • R24-11rel:R24-11#f4403dc22026-10-14
  • R25-11rel:R25-11#18fcf54f2026-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_01114]

Optional & operator= (const Optional &other) &noexcept(std::is_ nothrow_copy_constructible< T >::value &&std::is_nothrow_copy_ assignable< T >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept 2. Function is declared with the ref-qualifier &

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01114
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01114@rel:R25-11#82110c91
Content hash
82110c91
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01114
Status: valid/unmigrated Version: rel:R25-11#6ca0c9a7 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_01114@rel:R25-11#6ca0c9a7
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#53d125022026-09-30
  • R24-11rel:R24-11#d36bd1ce2026-10-14
  • R25-11rel:R25-11#6ca0c9a72026-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_01115]

Optional & operator= (Optional &&other) &noexcept(std::is_nothrow_ move_assignable< T >::value &&std::is_nothrow_move_constructible< T >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is declared with the ref-qualifier &

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01115
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01115@rel:R25-11#ea527415
Content hash
ea527415
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01115
Status: valid/unmigrated Version: rel:R25-11#16e267f2 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_01115@rel:R25-11#16e267f2
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#f4c255c12026-09-30
  • R24-11rel:R24-11#6bfd4afd2026-10-14
  • R25-11rel:R25-11#16e267f22026-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_01116]

template <typename U = T> Optional & operator= (U &&u) &noexcept(std::is_nothrow_constructible< T, U >::value &&std::is_nothrow_assignable< T &, U >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept 2. Function is declared with the ref-qualifier &

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01116
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01116@rel:R25-11#03b28909
Content hash
03b28909
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01116
Status: valid/unmigrated Version: rel:R25-11#3e4d73de 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_01116@rel:R25-11#3e4d73de
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#be342f912026-09-30
  • R24-11rel:R24-11#3fce07582026-10-14
  • R25-11rel:R25-11#3e4d73de2026-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_01117]

template <typename U> Optional & operator= (const Optional< U > &) &noexcept(std::is_ nothrow_constructible< T, const U &>::value &&std::is_nothrow_ assignable< T &, const U &>::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept 2. Function is declared with the ref-qualifier &

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01117
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01117@rel:R25-11#5d2b4b1a
Content hash
5d2b4b1a
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01117
Status: valid/unmigrated Version: rel:R25-11#d5d06ba9 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_01117@rel:R25-11#d5d06ba9
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#68ae4d392026-09-30
  • R24-11rel:R24-11#a7a5f0f32026-10-14
  • R25-11rel:R25-11#d5d06ba92026-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_01118]

template <typename U> Optional & operator= (Optional< U > &&) &noexcept(std::is_nothrow_ constructible< T, U >::value &&std::is_nothrow_assignable< T &, U >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept 2. Function is declared with the ref-qualifier &

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01118
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01118@rel:R25-11#4d818373
Content hash
4d818373
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01118
Status: valid/unmigrated Version: rel:R25-11#083436fb 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_01118@rel:R25-11#083436fb
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#615224ed2026-09-30
  • R24-11rel:R24-11#bc5224af2026-10-14
  • R25-11rel:R25-11#083436fb2026-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

函数 reset [SWS_CORE_01136]

void reset () noexcept;

As per corresponding usage in [optional]

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

类 ara::core::Optional 的成员函数 reset 通过头文件 #include "ara/core/optional.h" 提供,用于重置实例 [SWS_CORE_01136]。该函数具有签名 void reset () noexcept;,不接收任何参数且不提供返回值 [SWS_CORE_01136]。其行为遵循 [optional] 中的相应用法 [SWS_CORE_01136];解释:基于此参考,该调用可能销毁任何存在的状态值并将实例转换为未置位状态。 问题 Q-c819444ae1a7df1f (未决)

在错误处理和异常处理方面,reset 被声明为异常安全(exception safe)以及标识符 noexcept [SWS_CORE_01136]。既不引发异常,也不返回错误代码 [SWS_CORE_01136]。

在与 Core 库的其他组件交互中,以下关联具有相关性:

  • 对于可选引用 ara::core::Optional<T&>,存在被指定为 constexpr 的 reset 重载,该重载同样为 noexcept 且异常安全 [SWS_CORE_01165]。
  • 与 Optional 区分开来,头文件 ara/core/bitset.h 中的类型 ara::core::Bitset 同样提供 reset 函数:一种引用修改后位集的无参变体 [SWS_CORE_01727],以及带有 Result 返回并检查 IsoStdOutOfRangeViolation 的基于位置的重载 [SWS_CORE_01728]。

此文本为自动生成。所有信息均基于 AUTOSAR Adaptive R25-11 规范范围。

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

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

Record
AUTOSAR/AP/record/SWS_CORE_01136
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01136@rel:R25-11#701a886f
Content hash
701a886f
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01136
Status: valid/unmigrated Version: rel:R25-11#6d9fb635 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_01136@rel:R25-11#6d9fb635
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#bde8a7be2026-09-30
  • R24-11rel:R24-11#4d4a35c12026-10-14
  • R25-11rel:R25-11#6d9fb6352026-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

函数 swap [SWS_CORE_01121]

void swap (Optional &) noexcept(std::is_nothrow_move_constructible< T >::value &&std::is_nothrow_move_assignable< T >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Conditions for the conditional exception safety are modified

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01121
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01121@rel:R25-11#3bcc816c
Content hash
3bcc816c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01121
Status: valid/unmigrated Version: rel:R25-11#ec32d4dd 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_01121@rel:R25-11#ec32d4dd
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#f13812c02026-09-30
  • R24-11rel:R24-11#6c6900ce2026-10-14
  • R25-11rel:R25-11#ec32d4dd2026-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 [SWS_CORE_01130]

constexpr const T & value () const & noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01130
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01130@rel:R25-11#c2164255
Content hash
c2164255
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01130
Status: valid/unmigrated Version: rel:R25-11#f3e37107 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_01130@rel:R25-11#f3e37107
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#d33dc7152026-09-30
  • R24-11rel:R24-11#dd5d01932026-10-14
  • R25-11rel:R25-11#f3e371072026-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 [SWS_CORE_01131]

constexpr T & value () & noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01131
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01131@rel:R25-11#8ab2dd54
Content hash
8ab2dd54
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01131
Status: valid/unmigrated Version: rel:R25-11#bd11e736 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_01131@rel:R25-11#bd11e736
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#68af222c2026-09-30
  • R24-11rel:R24-11#3d037a0d2026-10-14
  • R25-11rel:R25-11#bd11e7362026-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 [SWS_CORE_01132]

constexpr T && value () &&noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01132
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01132@rel:R25-11#957e9c2b
Content hash
957e9c2b
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01132
Status: valid/unmigrated Version: rel:R25-11#24f00cb3 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_01132@rel:R25-11#24f00cb3
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#414433c42026-09-30
  • R24-11rel:R24-11#2e6187fb2026-10-14
  • R25-11rel:R25-11#24f00cb32026-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 [SWS_CORE_01133]

constexpr const T && value () const &&noexcept;

As per corresponding usage in [optional] except for the following deviations: 1. The function is noexcept 2. A IsoStdBadOptionalAccessViolation may conditionally be raised (see condition)

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitexception safe
Verletzungen (Violations)IsoStdBadOption- If *this does not contain a value alAccessViolation

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

Record
AUTOSAR/AP/record/SWS_CORE_01133
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01133@rel:R25-11#2b0f220c
Content hash
2b0f220c
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01133
Status: valid/unmigrated Version: rel:R25-11#7b7d6eb7 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_01133@rel:R25-11#7b7d6eb7
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#54a5ac7f2026-09-30
  • R24-11rel:R24-11#f020185a2026-10-14
  • R25-11rel:R25-11#7b7d6eb72026-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_or [SWS_CORE_01134]

template <typename U> constexpr T value_or (U &&) const &;

As per corresponding usage in [optional]

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

使用

根据 [SWS_CORE_01134],类 ara::core::Optional 的模板成员函数 value_or 用于同步检索包含的值或提供的备用值。它通过头文件 #include "ara/core/optional.h" 引入,并以签名 template <typename U> constexpr T value_or (U &&) const &; 声明为常量左值引用方法。其行为遵循 std::optional 的相应定义(“As per corresponding usage in [optional]”),由此在设置了内容时返回值 T,否则返回传入的默认值。

错误处理与异常安全性

关于错误处理,根据 [SWS_CORE_01134],该函数明确指定为非异常安全(“not exception safe”)。该调用未定义错误代码、DET 或 DEM 消息。转换或复制操作期间引发的异常因此可以向外传播。

相互作用

在 ara::core::Optional 内存在 value_or 的互补重载:

  • [SWS_CORE_01135] 提供了右值重载 template <typename U> constexpr T value_or (U &&) &&;,它同样被声明为非异常安全(“not exception safe”),并支持针对临时对象优化的移动操作。
  • [SWS_CORE_01175] 指定了特化 ara::core::Optional<T&> 的重载(签名 template <typename U> constexpr T value_or (U &&u) const noexcept;),与 [SWS_CORE_01134] 相比,它被标记为异常安全(“exception safe”)。

本使用说明为自动生成,完全基于 AUTOSAR Release R25-11 的规范数据。

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitnot exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01134
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01134@rel:R25-11#1e63fd67
Content hash
1e63fd67
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01134
Status: valid/unmigrated Version: rel:R25-11#7c04631e 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_01134@rel:R25-11#7c04631e
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#60f23a902026-09-30
  • R24-11rel:R24-11#75fa1c852026-10-14
  • R25-11rel:R25-11#7c04631e2026-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_or [SWS_CORE_01135]

template <typename U> constexpr T value_or (U &&) &&;

As per corresponding usage in [optional]

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

使用

模板类 ara::core::Optional 的右值限定成员函数 value_or 通过头文件 ara/core/optional.h 提供 [SWS_CORE_01135]。根据对 [optional] 的引用,它用于同步查询包含的值或返回传入的替代值。由于该调用绑定到右值引用,因此如果存在值,包含的值大概会通过移动语义传递;否则将对传入的参数求值并转换。 问题 Q-e20f155d58dd0d72 (未决)

相互作用与重载

该函数补充了 const 左值重载 [SWS_CORE_01134],后者为长生命周期或非临时实例提供了相同的后备机制。对于引用特化 ara::core::Optional<T &>,存在一个被声明为 noexcept 的不同签名 [SWS_CORE_01175],而通用重载则适用于值类型的右值。

错误处理与异常安全性

该方法被明确声明为 not exception safe [SWS_CORE_01135]。不存在特定的错误码、DET 或 DEM 报告。解释:如果在生成返回值时发生错误,潜在的异常可能主要源自相关类型 T 和 U 的移动构造函数或转换运算符。 问题 (未决)

本文由人工智能创建,完全基于 Release R25-11 的规范。

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitnot exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01135
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01135@rel:R25-11#ff18d993
Content hash
ff18d993
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01135
Status: valid/unmigrated Version: rel:R25-11#b12481cc 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_01135@rel:R25-11#b12481cc
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#4e564dbd2026-09-30
  • R24-11rel:R24-11#e796ceb42026-10-14
  • R25-11rel:R25-11#b12481cc2026-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

函数 ~Optional [SWS_CORE_01112]

~Optional () noexcept(std::is_nothrow_destructible< T >::value);

As per corresponding usage in [optional] except for the following deviations: 1. Function is conditionally noexcept

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Exception-Sicherheitconditionally exception safe

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

Record
AUTOSAR/AP/record/SWS_CORE_01112
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01112@rel:R25-11#ab225ffb
Content hash
ab225ffb
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01112
Status: valid/unmigrated Version: rel:R25-11#28cb7e57 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_01112@rel:R25-11#28cb7e57
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#d0e776bc2026-09-30
  • R24-11rel:R24-11#56a370392026-10-14
  • R25-11rel:R25-11#28cb7e572026-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_01102]

using value_type = T;

As per corresponding usage in [optional]

Header-Datei#include "ara/core/optional.h"
Scopeclass ara::core::Optional
Symbolvalue_type

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

Record
AUTOSAR/AP/record/SWS_CORE_01102
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_CORE_01102@rel:R25-11#b74bd1b8
Content hash
b74bd1b8
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_Core.pdf#nameddest=SWS_CORE_01102
Status: valid/unmigrated Version: rel:R25-11#6430c943 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_01102@rel:R25-11#6430c943
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#0d70273d2026-09-30
  • R24-11rel:R24-11#75d4d87e2026-10-14
  • R25-11rel:R25-11#6430c9432026-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