Accessing typedef from the instance
Posted
by piotr
on Stack Overflow
See other posts from Stack Overflow
or by piotr
Published on 2010-06-18T09:36:49Z
Indexed on
2010/06/18
9:53 UTC
Read the original article
Hit count: 262
As in stl containers, why can't we access a typedef inside the class from the class instance? Is there a particular insight into this?
When value_type was a template parameter it could help making more general code if there wasn't the need to specify the template parameters as in vector::value_type
Example:
class T {
public:
typedef int value_type;
value_type i;
};
T t;
T::value_type i; // ok
t.value_type i; // won't work
© Stack Overflow or respective owner