I\'ve a QMap
object and I am trying to write its content to a file.
QMap extensions;
//..
for(auto e : extensions)
{
fou
Ivan Čukić of KDAB has a blog post that explains how to iterate over a QMap
with C++17 structured bindings without copying the container:
template
class asKeyValueRange
{
public:
asKeyValueRange(T &data) : m_data{data} {}
auto begin() { return m_data.keyValueBegin(); }
auto end() { return m_data.keyValueEnd(); }
private:
T &m_data;
};
...
QMap extensions;
for (auto [key, value]: asKeyValueRange(extensions))
{
fout << key << ',' << value << '\n';
}