Utils: Add iterator constructors to small string

Change-Id: Ib8fcacd5dc520842cf5cee73ea21c021221158ca
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2016-08-01 17:19:50 +02:00
parent 7610e48716
commit 390e2d164c
2 changed files with 37 additions and 0 deletions

View File

@@ -127,6 +127,16 @@ public:
: SmallString(SmallString::fromQString(qString))
{}
template<typename BeginIterator,
typename EndIterator,
typename = typename std::enable_if<std::is_same<BeginIterator, EndIterator>::value>::type
>
SmallString(BeginIterator begin, EndIterator end)
: SmallString(&(*begin), size_type(end - begin))
{
}
~SmallString() noexcept
{
if (Q_UNLIKELY(hasAllocatedMemory()))