From kde-panel-devel Mon Jan 02 21:09:11 2017 From: =?UTF-8?B?SXZhbiDEjHVracSH?= Date: Mon, 02 Jan 2017 21:09:11 +0000 To: kde-panel-devel Subject: Re: FYI: New calendar project (uses C++14 and C++17). Message-Id: X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=148339139827128 Look ok to me. I hate Qt data models, so I'm not the best person to comment on them. As for the date stuff, you can check out the boost library (used in Eric's talk) - I guess you would have less things to reimplement yourself. Cheers, Ivan On Mon, Jan 2, 2017 at 11:21 AM, Mark Gaiser wrote: > On Mon, Jan 2, 2017 at 10:46 AM, Ivan =C4=8Cuki=C4=87 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=3Dc++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 th= at > 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. Th= at > made the zip redundant and with that the (only use of) structured binding= s > 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 unsu= re > 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 perha= ps > 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 w= ith > 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/fixedmo= nthmodel.cpp --=20 KDE, ivan.cukic@kde.org, http://cukic.co/ gpg key fingerprint: 292F 9B5C 5A1B 2A2F 9CF3 45DF C9C5 77AF 0A37 240A