Utils: Make SmallString(std::string) a template

Normal contructors are called before templated constructors. So it would
call SmallString(std::string("foo)) for SmallString("foo"). To prevent that
we change it to a template constructor.

Change-Id: Ibd249cedd638cbc2e6755c988be41fa5bb6e1ff6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2016-10-18 18:18:20 +02:00
committed by Tim Jenssen
parent cb3064a09e
commit 7cc348e048

View File

@@ -128,8 +128,11 @@ public:
: SmallString(SmallString::fromQString(qString))
{}
SmallString(const std::string &stdString)
: SmallString(stdString.data(), stdString.size())
template<typename Type,
typename = typename std::enable_if<
std::is_same<typename std::decay<Type>::type, std::string>::value>::type>
SmallString(Type &&string)
: SmallString(string.data(), string.size())
{}
template<typename BeginIterator,