Returning a template typedef

Hello, I'd like to know what's wrong with the following piece of code:

template <class Type> class Locator
{
private:
Type b;
public:
typedef Locator<Type>* L_ptr;
Locator <Type>(Type y = 0): b(y) {};
L_ptr address(Locator<Type>&);
};

template <class Type>
L_ptr Locator<Type>::address(Locator<Type>& L)
{
return &L;
}


The compiler doesn't protest when I use this typedef as a function argument (it's not shown here) but it doesn't accept it as a return value.
Apparently there is a problem with returning a typedef from a member function. Is it generally forbidden or maybe I made a mistake here somewhere? I tried adding 'typename' to the typedef declaration but the effects are the same.
Appreciate any help.
The problem is that in your function definition L_ptr is not in scope, so you must use Locator<Type>::L_ptr instead of just L_ptr.
OMG you're right...that's why I hate C++ sometimes. Thanks :)
That's not a problem with C++ though :O
Topic archived. No new replies allowed.