namespace std
User GuideAI-GENERATED
Enables integration of ara::core types into standard containers and language facilities of the C++ Standard Library.
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.
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>andstd::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<...>>, andstd::hash<ara::core::Vector<T, Allocator>>enable hashing of complex type structures. Interpretation: The specializations forara::core::Optionalandara::core::Variantare 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, whilestd::tuple_element<I, ara::core::Array<T, N>>determines the data type of positionI. Interpretation: The specializations ofstd::tuple_sizeandstd::tuple_elementare thus likely to enable the use ofara::core::Arraywith 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::hashis instantiated for a nested type such asara::core::Optional<T>orara::core::Vector<T, Allocator>, a valid specialization ofstd::hashmust also exist for element typeT. 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 indexI >= Nviolates 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.
No element data available for this release
Classes
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]
gemini-3.8-flash-low· 2026-10-13 · German original