KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Please, see what I am trying to do: #include <iostream> namespace first { template <class T> class myclass { T t; public: void who_are_you() const { std::cout << "first::myclass"; } }; } namespace second { using first::myclass; template <> class myclass <int> { int i, j; public: void who_are_you() const { std::cout << "second::myclass"; } }; } This isn't allowed. Could you please, clarify why can't specializations be in different namespaces, and what are the available solutions? Also, is it something fixed in C++0x? This would allow me for example, to specialize std::max , std::swap , std::numeric_limits , etc.. without resorting to undefined behavior by adding something to ::std:: ? @AndreyT Here is how I though I would use it: // my_integer is a class std::numeric_limits<my_integer>::max(); // specialized std::numeric_limits for my_integer Can this be done?
Tags (comma-separated)
Save Edits
Cancel