std::generate in modern c++

Posted on Fri 27 January 2023 in tech • Tagged with c++, std::generate, lambda, tutorial

std::generate

Many examples of std::generate in C++ involve a static. However using a static introduces issues around thread safety and usability in modern code. Here is a simple example using std::generate with a c++14 style lambda that defines and captures a local variable.

Full tutorial on …


Continue reading