refs #311 added initializer_list constructors in containers

This commit is contained in:
Mathew Sutcliffe
2014-08-01 20:22:51 +01:00
parent 58318677b5
commit d6234ee2cd
4 changed files with 35 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
#include <type_traits>
#include <iterator>
#include <utility>
#include <initializer_list>
namespace BlackMisc
{
@@ -33,6 +34,12 @@ namespace BlackMisc
//! Insert a new value into the set.
typename QMap<T, T>::iterator insert(const T &value) { return QMap<T, T>::insert(value, value); }
//! Default constructor.
QOrderedSet() {}
//! Initializer list constructor.
QOrderedSet(std::initializer_list<T> il) { for (const auto &v : il) { insert(v); } }
};
/*!
@@ -64,6 +71,11 @@ namespace BlackMisc
*/
CCollection() : m_pimpl(new Pimpl<QOrderedSet<T>>(QOrderedSet<T>())) {}
/*!
* \brief Initializer list constructor.
*/
CCollection(std::initializer_list<T> il) : m_pimpl(new Pimpl<QOrderedSet<T>>(QOrderedSet<T>(il))) {}
/*!
* \brief Copy constructor.
*/