Zero overhead pass by value through invocable abstractions - Filipp Gelman

  Рет қаралды 304

Using std::cpp

Using std::cpp

Күн бұрын

This presentation focuses on what happens when non-trivial objects are passed to functions by value. Often this necessitates calling the copy or move constructor of the object's type. This call can be elided when the argument is a prvalue, such as when it is the result of another function or a temporary object of the expected type. The constructor can be elided even if the target function happens to be virtual.
But this doesn't work when invoking a std::function, std::move_only_function, std::function_ref, or even std::reference_wrapper. When the target of these abstractions takes objects by value, there will be at least one additional copy/move of the arguments even if they are prvalues.
But what if this were not the case?
This presentation will explain why library-level abstractions incur the overhead of an additional copy/move, and present a technique for avoiding this overhead.

Пікірлер: 2
@N....
@N.... 2 ай бұрын
23:30 this is a fantastic trick by the way, I was running into this same issue myself recently of needing to deal with function overload sets and templates, and I really appreciate you sharing this
@N....
@N.... 2 ай бұрын
Very interesting talk. I didn't know declval always returned a reference type, that's quite a big corner to be wary of. I wonder why it was done that way initially?
Using C++ in Airbus DS ISR Products, an overview - Carlos Gómez
42:48
Секрет фокусника! #shorts
00:15
Роман Magic
Рет қаралды 82 МЛН
C++ Type Erasure - Michael Hava
44:26
Using std::cpp
Рет қаралды 485
Perfect Hashing in an Imperfect World  - Joaquín M. López Muñoz
45:14
40 Years Of Software Engineering Experience In 19 Minutes
19:10
Continuous Delivery
Рет қаралды 55 М.
I made the same game in Assembly, C and C++
4:20
Nathan Baggs
Рет қаралды 722 М.
The new MISRA C++ 2023 Safety Guidelines  - Peter Sommerlad
1:07:41
Using std::cpp
Рет қаралды 619
Pass By Value and Pass By Reference In Java | Java Tutorials
26:02