I wrote some class with template:
template <class T, class Allocator = ::std::allocator<T> >
class my_list;
I should write ::std::hash specializtion for this class. How can I do that? Simple partial specialization:
namespace std {
template <class T, class Allocator>
class hash<my_list<T, Allocator> >{
public :
size_t operator()(const my_list<T, Allocator> &x ) const{
return ...;
}
};
}
But I can't write simple partial specialization, because it forbidden by C++ ISO:
ISO/IEC 14882 Third edition 2011-09-01
17.6.4.2.1 Namespace std [namespace.std]
2 The behavior of a C++ program is undefined if it declares ... an explicit or partial specialization of any member class template of a standard library class or class template.
What can I do?
See Question&Answers more detail:os