Changes between Version 28 and Version 29 of Coding_Conventions
- Timestamp:
- Jul 14, 2015, 6:38:18 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Coding_Conventions
v28 v29 230 230 * Be sure to be aware of [CodeAndMemoryPerformance Code And Memory Performance] guidelines 231 231 232 * Use "for range" loop instead of "std::for_each" when you use "begin()" and "end()" parameters233 {{{ 234 #!cpp 235 // Avoid232 * Use "for range" loop instead of "std::for_each". 233 {{{ 234 #!cpp 235 // Avoid 236 236 std::vector<T> anyVector; 237 237 std::for_each(anyVector.begin(), anyVector.end(), [] (const T& element){ … … 239 239 } 240 240 241 // Better242 for ( auto& element : anyVector)241 // Better 242 for (const T& element : anyVector) 243 243 { 244 244 //code 245 } 246 }}} 247 248 * Reminding the default value of parameters, if any, in a function definition can be useful. 249 {{{ 250 #!cpp 251 int Increase(int param, int optionalParam = 1); 252 253 //... 254 255 int Increase(int param, int optionalParam /* = 1 */) 256 { 257 return param + optionalParam; 245 258 } 246 259 }}}