Lets say there is a templated class:
template<typename T>
class Storage
{
public:
static std::map<T, std::vector<std::string> > things;
};
And now I want to specialize it for type int and initialize things.
The way that does not throw compile errors I found so far is this:
template<>
std::map<int, std::vector<std::string> > Storage<int>::things = {
{ 1, {"FOO", "foo"} },
{ 2, {"BAR", "bar"} },
{ 3, {"ZAR", "zar"} }
};
But how it turns out that we can specialize the class and initialize the static member at the same time ?
Aucun commentaire:
Enregistrer un commentaire