I have a class that overloads the bit shift operator like the following:
template<typename DataType>
friend Packet& operator << (Packet& pkt, const DataType& data)
{
std::cout << "this compiles" << std::endl;
}
but when I try to make a specialization of it like this :
template<typename DataType>
friend Packet& operator << (Packet& pkt, const DataType& data)
{
std::cout << "this doesn't compile" << std::endl;
}
template<>
friend Packet& operator<<<std::string> (Packet& pkt, const std::string& data)
{
std::cout << "this doesn't compile" << std::endl;
}
it throws a compile time error:
Error C2116 'operator <<': function parameter lists do not match between declarations
what I'm I doing wrong here ?
Aucun commentaire:
Enregistrer un commentaire