the problem is obviously that there is no cunstructor in A<const T> to accept A<T>.
i have been brain cracking how to to create the constructor solution.
I was thinking i might as well make a public instead of private.
Any help please?
Re: casting Class<typename> to Class<const typename>
I don't think you can.
You can get a const A<T> from an A<T>, but not a A<const T> from a A<T>
That's just the way templates are.
However....
What you could do is provide a way to cast a T to a const T to construct a new A<const T> using a T, but not a A<T>.
If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).
Bookmarks