samedi 4 avril 2015

How to specialize function template for a container?

I have function template that implements storing POD into stream:



template<typename T>
void dumps(std::ostream &os, const T &t)
{
os.write(reinterpret_cast<const char *>(&t), sizeof(t));
}


Is there a way to specialize this template for containers to store container size and then call general implementation for container items?


Aucun commentaire:

Enregistrer un commentaire