[Development] Proposal: Deprecating platforms in Qt 5.6 that don't support lambda
Thiago Macieira
thiago.macieira at intel.com
Fri Feb 20 20:42:55 CET 2015
On Friday 20 February 2015 12:53:24 Matthew Woehlke wrote:
> for (auto const i : qtEnumerate(map))
>
> Maybe it would be nice for Qt to provide one or both of these?
Sounds easy enough. Want to give it a try?
Note that this should also work for foreach:
foreach (const auto i, qtEnumerate(map))
Something like:
template <typename Map>
struct QEnumerateMap : private Map
{
struct const_iterator {
typename Map::iterator i;
iterator(typename Map::iterator i) : i(i) {}
// need to return by value
std::pair<typename Map::key_type, typename Map::value_type>
value() const
{ return std::make_pair(i.key(), i.value()); }
};
const_iterator begin() const
{ return iterator(Map::begin()); }
const_iterator end() const
{ return iterator(Map::end()); }
};
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list