std::generate in modern c++

Posted on Fri 27 January 2023 in tech

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 YouTube:

John's Basement