I got error compiling below code.
struct B{
double operator()(){
return 1.0;
}
};
struct A {
auto func() -> decltype(b())
{
You can also get it to work like this:
struct B
{
double operator()()
{
return 1.0;
}
};
// my implementation does not have std::declval
template < typename T > T&& declval();
struct A
{
B b;
auto func() -> decltype(declval().operator()())
{
return b();
}
};
edit: or since B is in scope already anyway no need for auto, -> decltype and declval
struct A
{
B b;
decltype(Q()()) func()
{
return b();
}
};