std::expected<T,E>::transform_error

If *this contains an unexpected value, invokes f with the unexpected value of *this as the argument and returns a std::expected object that contains an unexpected value, which is initialized with the result of f. Otherwise, returns a std::expected object that represents an expected value.

# Declarations

Primary template
template< class F >
constexpr auto transform_error( F&& f ) &;

(since C++23)

template< class F >
constexpr auto transform_error( F&& f ) const&;

(since C++23)

template< class F >
constexpr auto transform_error( F&& f ) &&;

(since C++23)

template< class F >
constexpr auto transform_error( F&& f ) const&&;

(since C++23)

void partial specialization
template< class F >
constexpr auto transform_error( F&& f ) &;

(since C++23)

template< class F >
constexpr auto transform_error( F&& f ) const&;

(since C++23)

template< class F >
constexpr auto transform_error( F&& f ) &&;

(since C++23)

template< class F >
constexpr auto transform_error( F&& f ) const&&;

(since C++23)

# Parameters

# Return value

Given expression expr as:

# Example

This section is incompleteReason: no example

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 3938C++23the expected value was obtained by value()[1]changed to **this
LWG 3973C++23the expected value was obtained by **this[2]changed to val

# See also