Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/iterator/projected value t"

From cppreference.com
< cpp‎ | iterator
(+ missing _t)
m (Notes: FTM's name was shrunk.)
 
Line 19: Line 19:
  
 
===Notes===
 
===Notes===
{{feature test macro|__cpp_lib_default_template_type_for_algorithm_values|default template type for algorithm values using {{tt|std::projected_value_t}}|value=202403L|std=C++26}}
+
{{feature test macro|__cpp_lib_algorithm_default_value_type|default template type for algorithm values using {{tt|std::projected_value_t}}|value=202403L|std=C++26}}
  
 
===Example===
 
===Example===

Latest revision as of 14:42, 13 July 2024

 
 
Iterator library
Iterator concepts
Iterator primitives
Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(C++20)
(C++20)
(C++20)
Utilities
(C++20)
projected_value_t
(C++26)
Iterator adaptors
Range access
(C++11)(C++14)
(C++14)(C++14)  
(C++11)(C++14)
(C++14)(C++14)  
(C++17)(C++20)
(C++17)
(C++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_t<Proj&, std::iter_value_t<I>&>>;
(since C++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.

Contents

[edit] Template parameters

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

[edit] Notes

Feature-test macro Value Std Feature
__cpp_lib_algorithm_default_value_type 202403L (C++26) default template type for algorithm values using std::projected_value_t

[edit] Example

[edit] See also

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