How can I avoid the fact that not all control paths return a Container here:
enum Type {Int, String};
Container containerFactory(Type type)
{
switch(type)
{
case Int:
return Container (std::vector<int>());
case String:
return Container (std::vector<std::string>());
}
}
UPDATE: I was thinking that I could cast an exception here but I can't unit test this as it isn't possible to pass an invalid Type to the function.