std::projected_value_t(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– std::projected_value_t(3) πŸ’–

okay bestie, welcome to the std::projected_value_t(3) page from the C++ Standard Libary β€” manual name folded in near the top, just like we said, and we are not copying the whole header line because we have main character energy today ✨


🌸 NAME 🌸

std::projected_value_t β€” and the one-liner is literally also std::projected_value_t. iconic self-reference, no notes πŸ’…


πŸ“œ Synopsis πŸ“œ

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 C++26)

so here's the tea πŸ«–: the alias template projected_value_t obtains the value type by stripping any reference and its topmost cv-qualifiers from the result type of applying Proj to std::iter_value_t<I>&.

and yes, projected_value_t is used to determine the default value type in some algorithms such as ranges::contains. slay πŸ’–


🧚 Template parameters 🧚

  • I β€” an indirectly readable type
  • Proj β€” projection applied to an lvalue reference to value type of I

✨ Notes ✨

feature-test macro check, bestie πŸ‘‘

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

πŸŽ€ Example πŸŽ€

This section is incomplete Reason: no example 😭

πŸ¦‹ See also πŸ¦‹

  • indirect_result_t (C++20) β€” computes the result of invoking a callable object on the result of dereferencing some set of indirectly_readable types (alias template)
  • projected (C++20) β€” helper template for specifying the constraints on algorithms that accept projections (class template)

🏷️ Category 🏷️

  • Todo no example πŸ™ˆ

mwah πŸ’‹ β€” source and version/date sign-off: http://cppreference.com, 2024.06.10, page std::projected_value_t(3). periodt 🌈

πŸ“¦ where this page comes from