I\'d like to write a function template that operates on a container of strings, for example a std::vector
.
I\'d like to support both CString
You could provide function overloads that do what you need:
size_t getSize(const std::string& str)
{
return str.size();
}
size_t getSize(const CString& str)
{
return str.GetLength();
}
template
void DoSomething(const ContainerOfStrings& strings)
{
for (const auto & s : strings)
{
...
auto size = getSize(s);
...
}
}