• Advertisement

Archived

This topic is now archived and is closed to further replies.

template class specialization in namespace?

This topic is 5019 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I was thinking about this: 1. a namespace containing a template function
namespace TEST_NAMESPACE {
	template <class T>
	bool is_true() {
		return 0;
	};
};
 
2. adding to the namespace works fine: (I specialize the template function)
namespace TEST_NAMESPACE {
	template <>
	bool is_true<SomeClass>() {
		return 0;
	};
};
 
3. adding to a namespace from a class doesn''t seem to work
template <class T>
class ClassToEditTEST_NAMESPACE {
public:
	namespace TEST_NAMESPACE {
		template <>
		bool is_true<T>() {
			return 1;
		}
	};
};
 
So, Is there any way of adding to TEST_NAMESPACE from within the class ClassToEditTEST_NAMESPACE ? thank you !

Share this post


Link to post
Share on other sites
Advertisement
No. Namespaces are toplevel entities.

Share this post


Link to post
Share on other sites

  • Advertisement