std::hash template partial specialization

后端 未结 1 1778
一向
一向 2020-12-16 20:10

I wrote some class with template:

 template  >
 class my_list;

I should write ::st

相关标签:
1条回答
  • 2020-12-16 20:29

    The paragraph you're quoting does not apply. You're partialy specialising a class template (std::hash), not a member class template of a standard library class or class template. std::hash is not a member of any class or class template.

    For your case, paragraph 1 of the same section applies, and that allows specialisation when at least one user-defined type is involved (emphasis mine):

    The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified. A program may add a template specialization for any standard library template to namespace std only if the declaration depends on a user-defined type and the specialization meets the standard library requirements for the original template and is not explicitly prohibited.

    0 讨论(0)
提交回复
热议问题