libQuotient
A Qt library for building matrix clients
|
An adaptor for Qt (hash-)maps to make them iterable in STL style. More...
#include <util.h>
Public Member Functions | |
asKeyValueRange (T data) | |
An adaptor for Qt (hash-)maps to make them iterable in STL style.
QMap/QHash container iterators returned by begin() and end() dereference to values, unlike STL where similar iterators dereference to key-value pairs. It is a problem in range-for if you want to also access map keys. This adaptor allows to use range-for syntax with access to both keys and values in QMap/QHash containers. Just use for (auto&& [key, value] : asKeyValueRange(myMap)
instead of for (auto&& value : myMap)
.
|
inlineexplicit |