On Mon, Jan 2, 2017 at 10:46 AM, Ivan Čukić <ivan.cu...@kde.org> wrote:
> Hi Mark, > > An alternative to Niebler's range-v3 and cppitertools you might want > to try is boost.range (it is a part of the default boost package, I > don't know whether it has everything you'd need for this). > > I haven't seen where you used struct-bindings - the code compiles fine > with gcc -std=c++14. > > Cool you've started playing with things like these :) > > Cheers, > Ivan > Hi Ivan, You're right, i'm not using structured bindings anymore. I didn't want to drop them, but i simplified my code before pushing it to github ;) Before my initial commit i had a vector of days for each month. While iterating through months i also needed to know the number of days till that point so i used a zip iterator like this for (auto&& [daysThusFar, month] : iter::zip(...)) { } But i simplified that to use an algorithm for figuring out how many days are in any given month and just increment a counter for the days thus far. That made the zip redundant and with that the (only use of) structured bindings as well. Now it's just C++14 or perhaps even 11. My code looks 11, but the iter::range or iter::chunked iterators might require it to be C++14. Even then i play with "new" C++ features ;) Btw, do take a look at the model [1] I've made if you like. The model is derived from "QAbstractTableModel" which makes me a bit unsure if it would work in QML. Since QML seems to have a requirement for it's views to have the models be flat list models, not table models. But perhaps it's working just fine these days. I don't know, haven't tried it. The only thing the model misses is weeknumbers. Those can be calculated with a single std::tm instance (which i have in updateModel(...)) but i haven't implemented that yet. Cheers, Mark [1] https://github.com/markg85/cansole_calendar/blob/master/Qt/models/fixedmonthmodel.cpp