mercredi 9 mars 2022

Standard hash with variadic template

I have the following code:

namespace foo {
template<typename ...Types>
class Pi {
};
}

namespace std {
        template<> //line offending gcc 8.3.1
        template<typename ...Types>
        struct hash<foo::Pi<Types...>> {
            std::size_t operator()( const foo::Pi<Types...>& s ) const noexcept {
              return 0;
            }
        };
}


int main() {
   return 0;
}

Using gcc 8.3.1 I receive the error too much parameters template-parametr-list, while using gcc 4.8.3 it works. If I remove the commented line above it works, is it correct however?

Aucun commentaire:

Enregistrer un commentaire