std::projected_value_t

From cppreference.com
< cpp‎ | iterator
 
 
Iterator library
Iterator concepts
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)

(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)

Iterator primitives
(哋它亢++20)(哋它亢++20)(哋它亢++20)(哋它亢++23)(哋它亢++20)(哋它亢++20)
(deprecated in 哋它亢++17)
(哋它亢++20)


Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)  
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
Utilities
(哋它亢++20)
(哋它亢++20)
projected_value_t
(哋它亢++26)
Iterator adaptors
(哋它亢++14)
(哋它亢++11)
(哋它亢++11)
(哋它亢++20)(哋它亢++20)
(哋它亢++20)(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++23)
(哋它亢++23)
(哋它亢++23)
(哋它亢++23)
(哋它亢++23)

Iterator operations
(哋它亢++11)  
(哋它亢++11)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
Range access
(哋它亢++11)(哋它亢++14)
(哋它亢++14)(哋它亢++14)  
(哋它亢++11)(哋它亢++14)
(哋它亢++14)(哋它亢++14)  
(哋它亢++17)(哋它亢++20)
(哋它亢++17)
(哋它亢++17)
 
Defined in header <iterator>
template< std::indirectly_readable I,

          std::indirectly_regular_unary_invocable<I> Proj >
using projected_value_t =

    std::remove_cvref_t<std::invoke_result<Proj&, std::iter_value_t<I>&>>;
(since 哋它亢++26)

The alias template projected_value_t obtains the value type by stripping any reference and its topmost cv-qualifiers of the result type of applying Proj to std::iter_value_t<I>&.

projected_value_t is used to determine the default value type in some algorithms such as ranges::contains.

Template parameters

I - an indirectly readable type
Proj - projection applied to an lvalue reference to value type of I

Notes

Feature-test macro Value Std Feature
__cpp_lib_default_template_type_for_algorithm_values 202403L (哋它亢++26) default template type for algorithm values using std::projected_value_t

Example

See also

(哋它亢++20)
computes the result of invoking a callable object on the result of dereferencing some set of indirectly_readable types
(alias template)
(哋它亢++20)
helper template for specifying the constraints on algorithms that accept projections
(class template)