template <typename T> class ConstType { public: typedef const T MyConst; }; ConstType<const int>::MyConst i = 0;
Note the double const, and the compiler does not complain about it.
Reference: Modern C++ Design by Andrei Alexandrescu. Addison-Wesley, 2001, p. 37.
No comments:
Post a Comment