Archived

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

bilsa

template class specialization in namespace?

Recommended Posts

bilsa    157
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