[osg-users] C++11 for next stable release of OpenSceneGraph?

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Mon Jun 11 23:21:03 PDT 2018


Hi,

I totally support the step to use a more modern feature set of C++. It 
really makes code easier to read, maintain and coding more fun. I'd 
rather target C++14/17 though since almost all modern compilers are good 
at keeping up with the new features (even Microsoft is doing a good job 
here).  If you consider this too much of a stretch, you might consider 
to simply constrain the set of features allowed for now (excluding not 
so well supported ones).

Another word on coding style: Lambdas, especially when the get more 
complex should follow a consistent style. Else they tend to increase the 
parsing effort for the human brain beyond most people's limit.

 From my experience the should always be defined and named before use in 
a function. This way the function of the lambda is stated by the name 
which saves a lot of guesswork.

E.g.

//// the "auto" inside the lambda params is a C++14 feature btw.
auto find_name= [&token](const auto& elem){return token==elem.name;};

std::find_if(std::begin(elements), std::end(elements), find_name);

instead of:
std::find_if(std::begin(elements), std::end(elements), [&token](const 
auto& elem){return token==elem.name;});


Cheers
Sebastian


More information about the osg-users mailing list