templates and const

Started by
-1 comments, last by SparkyFlooner 19 years ago
I'm confused about how templates deal with 'const', and I can't find any literatur on it. Inside a template class, if the return type of a method is const T* and T = int then the actual return type is int* const or T = int* then the actual return type is int* const* Or declaring a vector: vector<const int> r; You would expect r[0] = 1 to cause a compiler error...but it doesn't - but vector<const int*> r; *r[0] = 3; does cause a compiler error. Can anyone shed some light on this, or point me in the right direction?

This topic is closed to new replies.

Advertisement