News for hackers. Stuff that matters.
Re:Modern C++ gamedev: thoughts and misconceptions by neutronicus on Saturday May 16, 2020 @10:22PM (#23208947)
Any time you want to pass a named unique_ptr across an API boundary, you'll need to std::move it
Re:Modern C++ gamedev: thoughts and misconceptions by jfkebwjsbx on Sunday May 17, 2020 @01:00AM (#23209714)
...which you should avoid as much as possible do.

Passing std types across API boundaries is a code smell.

Re:Modern C++ gamedev: thoughts and misconceptions by MauranKilom on Sunday May 17, 2020 @08:55AM (#23211646)
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?

Re:Modern C++ gamedev: thoughts and misconceptions by jfkebwjsbx on Sunday May 17, 2020 @04:45PM (#23215296)
The 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.