forked from qt-creator/qt-creator
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:
@@ -128,8 +128,11 @@ public:
|
|||||||
: SmallString(SmallString::fromQString(qString))
|
: SmallString(SmallString::fromQString(qString))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SmallString(const std::string &stdString)
|
template<typename Type,
|
||||||
: SmallString(stdString.data(), stdString.size())
|
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,
|
template<typename BeginIterator,
|
||||||
|
|||||||
Reference in New Issue
Block a user