tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
hash< etl::optional< T > > Struct Template Reference

The template specialization of etl::hash for the etl::optional class allows users to obtain hashes of the values contained in optional objects. More...

#include <etl/optional.hpp>

Public Member Functions

constexpr auto operator() (etl::optional< T > const &opt) const -> etl::size_t
 

Detailed Description

template<typename T>
struct etl::hash< etl::optional< T > >

The template specialization of etl::hash for the etl::optional class allows users to obtain hashes of the values contained in optional objects.

The specialization etl::hash<optional<T>> is enabled (see etl::hash) if etl::hash<etl::remove_const_t<T>> is enabled, and is disabled otherwise.

When enabled, for an object opt of type etl::optional<T> that contains a value, etl::hash<etl::optional<T>>()(opt) evaluates to the same value as etl::hash<etl::remove_const_t<T>>()(*opt). For an optional that does not contain a value, the hash is unspecified.

The member functions of this specialization are not guaranteed to be noexcept because the hash of the underlying type might throw.

https://en.cppreference.com/w/cpp/utility/optional/hash

Member Function Documentation

◆ operator()()

template<typename T>
auto operator() ( etl::optional< T > const & opt) const -> etl::size_t
inlinenodiscardconstexpr

The documentation for this struct was generated from the following file: