DEENESPTFRRUARHIKOZHNL

namespace std

User GuideAI-GENERATED

Enables integration of ara::core types into standard containers and language facilities of the C++ Standard Library.
AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: e52b54851dc1 Provenance Open questions (3)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Enables integration of ara::core types into standard containers and language facilities of the C++ Standard Library.

In module core, namespace std provides template specializations of std::hash, std::tuple_size, and std::tuple_element for data types of the AUTOSAR Adaptive Platform. This enables the direct use of types such as ara::core::String, ara::core::Optional, ara::core::Variant, ara::core::Vector, and ara::core::Array in standard containers and with C++ tuple language facilities. A constraint is that for nested types, the contained data types must also have valid specializations at compile time.

Context

In module core of the AUTOSAR Adaptive Platform, namespace std serves the seamless integration of platform-specific basic types into the C++ Standard Library. Instead of introducing new types, the namespace provides targeted template specializations of standardized helper classes. The interaction partners comprise three essential components: the generic types of the C++ Standard Library (in particular unordered associative containers and tuple utilities), the template specializations within std, and the data types ara::core::Array, ara::core::Monostate, ara::core::Optional, ara::core::String, ara::core::StringView, ara::core::Variant, and ara::core::Vector defined in module core.

std_context app Standard containers and language features (e.g., std::unordered_map, structured binding) std_spec Spezialisierungen in namespace std (std::hash, std::tuple_size, std::tuple_element) app->std_spec uses ara_types ara::core Datentypen (Array, Optional, String, StringView, Variant, Vector, Monostate) std_spec->ara_types includes

Context diagram: Interplay between standard containers, the specializations in std, and the ara::core types. Sources: Payload declarations of module core

The specializations of std::hash enable adaptive core data types to be used directly as keys in standard containers such as std::unordered_map or std::unordered_set. In parallel, specializations std::tuple_size and std::tuple_element for ara::core::Array extend support for standardized metaprogramming interfaces and language facilities.

Usage Path

A typical usage path begins with the use of an ara::core data type in generic C++ code. For example, an application declares a hash table with keys of type ara::core::String or ara::core::Optional<T>. During insertion, erasure, or lookup, the container implicitly accesses std::hash<ara::core::String> or std::hash<ara::core::Optional<T>>, respectively, to determine the key hash value.

The specializations cover different data structures:

  • Strings and views: std::hash<ara::core::String> and std::hash<ara::core::StringView> compute hash values over the contained character sequence.
  • Composite types: std::hash<ara::core::Optional<T>>, std::hash<ara::core::Variant<...>>, and std::hash<ara::core::Vector<T, Allocator>> enable hashing of complex type structures. Interpretation: The specializations for ara::core::Optional and ara::core::Variant are likely based on the semantic behavior of the standardized archetypes and produce deterministic values for empty or unoccupied states. Question Q-c432b06f0ba32c5e (open)
  • Stateless types: std::hash<ara::core::Monostate> provides a hash function for empty states, as typically used in variants.
  • Tuple protocol: For fixed data fields, std::tuple_size<ara::core::Array<T, N>> provides the element count at compile time, while std::tuple_element<I, ara::core::Array<T, N>> determines the data type of position I. Interpretation: The specializations of std::tuple_size and std::tuple_element are thus likely to enable the use of ara::core::Array with structured bindings. Question Q-3abb70390e67dbce (open)

Error Scenarios

Since the elements in namespace std are exclusively template specializations, error scenarios occur primarily at compile time. Typical problem constellations include:

  • Missing hashing capability of base types: If std::hash is instantiated for a nested type such as ara::core::Optional<T> or ara::core::Vector<T, Allocator>, a valid specialization of std::hash must also exist for element type T. If missing, this leads to a compilation error.
  • Invalid indexing in the tuple protocol: Access to std::tuple_element<I, ara::core::Array<T, N>> with an index I >= N violates the template precondition and aborts the compilation process.

Interpretation: Error scenarios are likely to be essentially limited to compile-time errors in the case of incomplete type specializations or static range violations, as the specification excerpt defines no runtime error codes or exception interfaces. Question Q-8cda269c72bd701c (open)

This guide is based exclusively on the declared class specializations of module core for Release R25-11.

Topic map

Class diagram

Abgerundete Rahmen = Namespace- bzw. Klassen-Scopes; hohle Dreieckspfeile = Vererbung (zeigt zur Basisklasse); graue Boxen = namespace-fremde bzw. externe Basisklassen. Klicken öffnet die jeweilige Klassen- bzw. cppreference-Seite.

G cluster_ns std nstd__hash__ara__core__Monostate__ «struct» hash< ara::core::Monostate > nstd__hash__ara__core__Optional__T__ «struct» hash< ara::core::Optional< T > nstd__hash__ara__core__Optional__T____ hash< ara::core::Optional< T > > nstd__hash__ara__core__String__ «struct» hash< ara::core::String > nstd__hash__ara__core__StringView__ «struct» hash< ara::core::StringView > nstd__hash__ara__core__Variant_ «struct» hash< ara::core::Variant< nstd__hash__ara__core__Variant__Types_______ hash< ara::core::Variant< Types... > > nstd__hash__ara__core__Vector__T__Allocator____ «struct» hash< ara::core::Vector< T, Allocator > > nstd__tuple_element__I__ara__core__Array__T__N____ «struct» tuple_element< I, ara::core::Array< T, N > > nstd__tuple_size__ara__core__Array__T_ «struct» tuple_size< ara::core::Array< T, next_integral__constant__size_t__N__ integral_ constant< size_t, N > nstd__tuple_size__ara__core__Array__T_->next_integral__constant__size_t__N__

Detail view

Select an entry in the outline.

Classes

hash class

Specialization of std::hash (hashing function for ara::core::Monostate) ≙ std::hash

Specializations hash< ara::core::Optional< T > hash< ara::core::String > hash< ara::core::StringView > hash< ara::core::Variant< hash< ara::core::Vector< T, Allocator > >

≙ [array]

≙ [array]