For example:
shared_ptr<const shared_ptr<const int> > pp;
is fairly intimidating… whereas
const int ^ const ^ pp;
is instantly reminiscent of the raw pointer equivalent
const int * const * pp;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Everyone missed the real reason 🙂
The nice notation T^ suggests action like a real pointer, which suggests conversions would work the same way. This is not the case. Templates can’t support conversions. For example consider
If you take ^ as *, this will work. However by default for a template:
will not work: templates are not covariant in their arguments. It is not possible to fix this in C++ AFAIK. You can handle that one conversion, but don’t forget the others:
just for example. If you want a real type system it has to be designed my mathematicians not compiler writers.