C++11版本不能使用一个单行命名空间方式特化一个函数的bug

warning: specialization of ‘template<class _Iterator> struct std::iterator_traits’ in different namespace [-fpermissive]

template<> class std::iterator_traits<Token_ptr>{
public:
    typedef Word difference_type;
    typedef Word value_type;
    typedef Token_ptr pointer;
    typedef Word& reference ;
    typedef std::bidirectional_iterator_tag iterator_category ;
};

While everything works correctly, does any body know what exactly means and why is issued the warning. ( g++ issues the warning while clang++ doesn't ).

https://stackoverflow.com/questions/25594644/warning-specialization-of-template-in-different-namespace
// gcc编译器处理模板特化的一个bug,必须此处用不能用单行命名空间,只能用大括号的命名空间

posted @ 2019-11-27 00:48  dzqabc  阅读(476)  评论(0编辑  收藏  举报