Small and Large Lambdas
Sometimes lambdas seem like a gift from heaven. They allow the quick generation of STL algorithms without all the headache of setting up the structure of a unary or binary op class, and the ability to create general closures with a single extra character allows not having to worry about specific capturing of members by reference or pointer for use inside the function. In C++14 and following the ability to define a stand-alone lambda with a given name allows for extra clarity when a given operation has to be executed several times but with a decidedly local context. (If I'm repeating the test-and-set pattern of auto setImplementations = [&](std::string_view inVal) { if (m_implementations.get() != nullptr) throw std::runtime_error( "Only one of -C, -d, -D, or -i allowed as type specification"); m_implementations = m_factory.create(inVal, m_names, m_dataRequirements); }; four ti...