Is this a good way to write code in C ++ 11?
int RawSheet :: getNumberOfCities () const {int n = 0; For (Cost Auto and C: Countries) {n + = c.getNumberOfCities (); } Return n; } Thanks
Experiment with lambda callback: < / P>
#include & lt; Algorithm & gt; Int RawSheet :: getNumberOfCities () const {return std :: accumulate (countries.begin (), countries.end (), 0, [] (Rochetta Constant and OA1, Rachit Concent and Op 2) {return op1.getNumberOfCities ( ) + Op2.getNumberOfCities ();}); }
No comments:
Post a Comment