C++17 evolution of https://en.cppreference.com/w/cpp/types/result_of
Questions tagged [invoke-result]
8 questions
8
votes
1 answer
invoke_result to obtain return type of template member function
How can I obtain the result type of a template member function?
The following minimal example illustrates the problem.
#include
template
struct A {
};
struct B {
template
A f() { return…

francesco
- 7,189
- 7
- 22
- 49
4
votes
2 answers
invoke_result with member (operator[]) function
How do I call invoke_result correctly for a member function? Or specifically for an operator member function. I tried std::invoke_result to no success. What would be the correct syntax in this case?

lightxbulb
- 1,251
- 12
- 29
3
votes
1 answer
Return default constructed or void from template function
I have a function that wraps another call with exception handling. Most invocation doesn't return anything (void) but for some invocation the function may return an int or the like. This works fine except Im left struggling with the default return…

darune
- 10,480
- 2
- 24
- 62
2
votes
1 answer
C++: How can one get return type of a class member function using std::invoke_result_t?
How can one get return type of a class member function using std::invoke_result_t in C++?
#include
#include
template
struct C
{
auto Get(void) const { return std::vector{1,2,3}; }
};
int main(void)
{
//…

S.V
- 2,149
- 2
- 18
- 41
1
vote
1 answer
Why std::invoke_result_t gives other return type for a callable than a trait?
Snippet:
#include
template
struct CallableTrait;
template
struct CallableTrait>
{
using ReturnType = R;
};
template
using CallableTraitT =…

Juergen
- 3,489
- 6
- 35
- 59
1
vote
2 answers
Accessing the return type of a method
I'm having a hard time getting this simple thing going.
One thing I found that works:
#include
struct A
{
int Method();
};
static_assert( std::is_same_v<
decltype(A{}.Method()), int
>
); // pass. cool.
Ok great. But…

v.oddou
- 6,476
- 3
- 32
- 63
0
votes
1 answer
Get return type of template method in a template class
I have a following not compiling code:
#include
#include
template
struct foo {};
template
struct bar {
template
auto func(Args... args)
{
return…

mouse_00
- 593
- 3
- 13
0
votes
1 answer
LambdaCall not returning payload in InvokeResult
I've created a function in an AWS lambda that invokes a second lambda function using a LambdaCall.
public InvokeResult invokeResponse() {
InvokeResult invokeResult = lambdaCall.invokeLambda(invokeRequestParameters.getFunctionName(),…

Hywel Griffiths
- 287
- 5
- 16