use of dependent type name must be prefixed
-
I have a code:
//add any arg # function to queue
template
auto Add(Func&& f, Args&&... args)
{
//get return type of the function
using RetType = std::invoke_result_t;and on last line, at compiling time I got:
error C7510: 'invoke_result_t': use of dependent type name must be prefixed with 'typename'
How can I overcome this error ? -
I have a code:
//add any arg # function to queue
template
auto Add(Func&& f, Args&&... args)
{
//get return type of the function
using RetType = std::invoke_result_t;and on last line, at compiling time I got:
error C7510: 'invoke_result_t': use of dependent type name must be prefixed with 'typename'
How can I overcome this error ?I believe that
typename
is supposed the be prefixed to tell the compiler thatinvoke_result_t
is defining a type:using RetType = std::typename invoke_result_t;
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing. -
I believe that
typename
is supposed the be prefixed to tell the compiler thatinvoke_result_t
is defining a type:using RetType = std::typename invoke_result_t;
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing. -
I have tried:
using RetType = std::typename invoke_result_t;
but I got:
error C2589: 'typename': illegal token on right side of '::'
Try moving it to the front:
using RetType = typename std::invoke_result_t;
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing. -
Try moving it to the front:
using RetType = typename std::invoke_result_t;
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing. -
I have a code:
//add any arg # function to queue
template
auto Add(Func&& f, Args&&... args)
{
//get return type of the function
using RetType = std::invoke_result_t;and on last line, at compiling time I got:
error C7510: 'invoke_result_t': use of dependent type name must be prefixed with 'typename'
How can I overcome this error ? -
I already did:
using RetType = typename std::invoke_result_t;
Result:
error C2760: syntax error: unexpected token '<', expected ';'
See "Helper types" on this page[^]. It looks like
invoke_result_t
is itself a type alias. Trystd::invoke_result
without the_t
.Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.