Suppose I have my custom string class:
class my_string : public std::string
{
// ...
}
And I want to make a templated function which accepts both with my_string
by default:
template <typename TString = my_string>
TString do_something(const TString& input)
{
// ...
}
But when I call it with:
auto result = do_something("abcdef");
It calls (of course) do_something<char[7]>()
. How to force it to call do_something<my_string>
without explicitly specifying the type (i.e. write do_something("abcdef")
, not do_something<my_string>("abcdef")
) ?