3 ms·
What? That's one of the primary motivations! "I have created an object and will pass its unique ownership to you." -> std::unique_ptr "This routine needs a fu
by MauranKilom 6y ago
What? That's one of the primary motivations!
"I have created an object and will pass its unique ownership to you." -> std::unique_ptr
"This routine needs a function that takes two ints and returns a float (without putting all my code into headers)." -> std::function<float(int, int)>.
Can you elaborate in what circumstance you should not pass std::types across API boundaries?
- jfkebwjsbx 6y agoThe heap allocation is an implementation detail. std::function is useful in some situations, but "without putting all my code into headers" is not a good argument.