Review Request 127419: Fix build with -DQT_STRICT_ITERATORS

Albert Astals Cid aacid at kde.org
Sat Mar 19 15:20:30 UTC 2016



> On March 18, 2016, 6:34 p.m., Albert Astals Cid wrote:
> > kstars/auxiliary/qcustomplot.cpp, line 21439
> > <https://git.reviewboard.kde.org/r/127419/diff/1/?file=453564#file453564line21439>
> >
> >     Do we really need this? mData is a member variable and the function is const so the lowerBound called here should be the const variant, no?
> 
> Andreas Cord-Landwehr wrote:
>     I agree that this would be a logical conclusion :)
>     However, AFAIK since the QMap::lowerBound method is overloaded only by a const specifier, the decisions whether calling the const or the non-const method is based on the const'ness of the object. What I did here is IMO the easiest way to let a stack-object behave as it was a const object. -- Without doing this, lowerBound returns a non-const iterator.

I got confused with pointer const, in a const method what you can't do is change the value of the poitner but you can call non const functions on the pointed object, so you're right, this is needed. Asume this is a +1 if noone blocks in a few days.


- Albert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127419/#review93689
-----------------------------------------------------------


On March 18, 2016, 7:44 a.m., Andreas Cord-Landwehr wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127419/
> -----------------------------------------------------------
> 
> (Updated March 18, 2016, 7:44 a.m.)
> 
> 
> Review request for KDE Edu and KStars.
> 
> 
> Repository: kstars
> 
> 
> Description
> -------
> 
> Avoid silent and implicit constness casts.
> 
> 
> Diffs
> -----
> 
>   kstars/auxiliary/qcustomplot.cpp 8d178be 
> 
> Diff: https://git.reviewboard.kde.org/r/127419/diff/
> 
> 
> Testing
> -------
> 
> Compilation tested.
> 
> 
> Thanks,
> 
> Andreas Cord-Landwehr
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20160319/5ebeb31d/attachment.html>


More information about the kde-edu mailing list