Sign in to follow this  
SparkyFlooner

templates and const

Recommended Posts

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this