std:: indirect_result_t
| Iterator concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterator primitives | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Algorithm concepts and utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Indirect callable concepts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Common algorithm requirements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Utilities | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterator adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Определено в заголовочном файле
<iterator>
|
||
|
template
<
class
F,
class
...
Is
>
требует
(
std::
indirectly_readable
<
Is
>
&&
...
)
&&
|
(начиная с C++20) | |
Псевдоним-шаблон
indirect_result_t
получает тип результата вызова
invocable
типа
F
на результате разыменования
indirectly_readable
типов
Is...
.
Параметры шаблона
| F | - | вызываемый тип |
| Is | - | косвенно читаемые типы, которые разыменовываются в аргументы |
Пример
#include <iterator> #include <type_traits> struct Fn { long operator()(const int&); int operator()(int&&); short operator()(int, int) const; auto operator()(const float) -> int&; void operator()(int[8]); }; static_assert( std::is_same_v<std::indirect_result_t<Fn, const int*>, long> and std::is_same_v<std::indirect_result_t<Fn, std::move_iterator<int*>>, int> and std::is_same_v<std::indirect_result_t<const Fn, int*, int*>, short> and std::is_same_v<std::indirect_result_t<Fn, float*>, int&> and std::is_same_v<std::indirect_result_t<Fn, int**>, void> ); int main() {}
Смотрите также
|
(C++11)
(removed in C++20)
(C++17)
|
определяет тип результата вызова вызываемого объекта с набором аргументов
(шаблон класса) |
|
(C++26)
|
вычисляет тип значения
indirectly_readable
типа посредством проекции
(псевдоним шаблона) |