mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
Convenience utilities
This commit is contained in:
@@ -213,6 +213,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Explicit conversion to any container of value_type which supports push_back. This will copy elements.
|
//! Explicit conversion to any container of value_type which supports push_back. This will copy elements.
|
||||||
|
//! @{
|
||||||
template <class T>
|
template <class T>
|
||||||
T to() const
|
T to() const
|
||||||
{
|
{
|
||||||
@@ -220,6 +221,12 @@ namespace BlackMisc
|
|||||||
std::copy(begin(), end(), Iterators::makeInsertIterator(container));
|
std::copy(begin(), end(), Iterators::makeInsertIterator(container));
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
template <template <class...> class T>
|
||||||
|
auto to() const
|
||||||
|
{
|
||||||
|
return to<T<value_type>>();
|
||||||
|
}
|
||||||
|
//! @}
|
||||||
|
|
||||||
//! Returns true if the range is empty.
|
//! Returns true if the range is empty.
|
||||||
//! @{
|
//! @{
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ namespace BlackMisc
|
|||||||
//! Return the metatype ID of the value in this variant.
|
//! Return the metatype ID of the value in this variant.
|
||||||
int userType() const { return m_v.userType(); }
|
int userType() const { return m_v.userType(); }
|
||||||
|
|
||||||
|
//! Return the QMetaType of the type in this variant.
|
||||||
|
QMetaType metaType() const { return QMetaType(userType()); }
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::JsonByMetaClass::toJson
|
//! \copydoc BlackMisc::Mixin::JsonByMetaClass::toJson
|
||||||
QJsonObject toJson() const;
|
QJsonObject toJson() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user