lundi 30 janvier 2017

c++ template specialization, error when using typename

I need to specialized a member function:

template <typename T>
int32_t writeVectorVariableUnit(
    foo& classFoo,
    typename std::vector<T>::const_iterator& start,
    typename std::vector<T>::const_iterator& stop,
    const std::string& name,
    const std::string& unit,
    const std::string& longName,
    const std::vector<std::string>& dimName) const

in this way:

template <>
int32_t writeVectorVariableUnit(
    foo& classFoo,
    std::vector<uint16_t>::const_iterator& start,
    std::vector<uint16_t>::const_iterator& stop,
    const std::string& name,
    const std::string& unit,
    const std::string& longName,
    const std::vector<std::string>& dimName) const;

but the g++ compiler (version 4.4.7 on a redhat 6.7) complains that is not able to match any template declaration:

error: template-id ‘writeVectorVariableUnit<>’ for ‘int32_t writeVectorVariableUnit(foo&, __gnu_cxx::__normal_iterator > >&, __gnu_cxx::__normal_iterator > >&, const std::string&, const std::string&, const std::string&, const std::vector, std::allocator >, std::allocator, std::allocator > > >&) const’ does not match any template declaration

I suspect that is related with the usage of typename, I try several combination without success. Do you have any suggestion?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire