Review Request 127864: Remove second list storing duplicate data

David Edmundson david at davidedmundson.co.uk
Sun May 8 12:21:16 UTC 2016



> On May 8, 2016, 10:49 a.m., Mark Gaiser wrote:
> > Modules/energy/batterymodel.cpp, line 60
> > <https://git.reviewboard.kde.org/r/127864/diff/1/?file=464499#file464499line60>
> >
> >     i=0
> >     i = 0 (spaces, nitpick)
> >     
> >     However, in this block (where you just want to find 1 element and be done with the loop) you might be better of using std:find_if here:
> >     
> >     auto result = std::find_if(m_batteries.constBegin(), m_batteries.constEnd() [&udi](const Solid::Device &dev){ return dev.udi() == udi});
> >     
> >     if (result == nullptr) {
> >         return;
> >     } else {
> >         int index = std::distance(m_batteries.constBegin(), result);
> >         ... the other code ...
> >     }
> >     
> >     ^^ not tested. But i think you get the point.

much neater, thanks.


- David


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


On May 8, 2016, 12:20 p.m., David Edmundson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127864/
> -----------------------------------------------------------
> 
> (Updated May 8, 2016, 12:20 p.m.)
> 
> 
> Review request for Plasma.
> 
> 
> Repository: kinfocenter
> 
> 
> Description
> -------
> 
> Remove second list storing duplicate data
> 
> 
> Diffs
> -----
> 
>   Modules/energy/batterymodel.h c319d197b7cab1bed67151db65193bc5bcb24e2b 
>   Modules/energy/batterymodel.cpp 7eade5498eda18ee0cfccddec70d5900c4eb2c96 
> 
> Diff: https://git.reviewboard.kde.org/r/127864/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> David Edmundson
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160508/acb75a18/attachment.html>


More information about the Plasma-devel mailing list