Decltype for return of a function

Viewed 5373

I am making a templated class that is a wrapper around any iterator. I am making the operator* this way:

template <typename T>
class MyIterator {
public:
    //...
    decltype(*T()) operator*() {
    //...
    }
}

I give decltype a invocation to operator* of class T, and it even works, but if T doesnt have default constructor it wont work.

Is there anyway to find out the returned type of a function/method ?

1 Answers
Related