3 ms·
If you're not capturing variables that allocate memory (like std::vector or std::string), there will be no allocations. And if you're that sensitive about hidde
by cyber_kinetist 5y ago
If you're not capturing variables that allocate memory (like std::vector or std::string), there will be no allocations. And if you're that sensitive about hidden allocations, chances are that you're going to avoid most of these STL types in the first place (no allocating constructors or RAII), so you won't probably need to worry about this. Even the people using C-like C++ ("Orthodox" C++) seem to use lambdas liberally when it make sense.
(Or maybe you're talking about putting a lambda into an std::function, which is a totally different thing and will probably incur heap allocation?)