Callable Objects in Java, C#, Rust, and C++ - Zhihao Yuan - ACCU 2023
Описание
ACCU Membership: https://tinyurl.com/ydnfkcyn
Sponsored By think-cell: https://www.think-cell.com/accu
https://accu.org
Callable Objects in Java, C#, Rust, and C++: You Are a Parenthesis - Zhihao Yuan - ACCU 2023
Slides: https://accu.org/conf-previous/accu2023/
It is trivial to make a class callable in C++. Just define operator(). But what if you cannot?
Adding operator() requires three things to check simultaneously: you're working on an object of a class type, you own the class type, and the action of "call" has an unambiguous meaning in the class. You may think a closure or a bind_front object will solve all problems. But, depending on which pieces are missing, such a solution can range from adequate to a code smell.
The talk will begin with an old tale: Java -- a language with no operator() and was transitioning to adding lambda. Then, we will look into how Java, C♯, and Rust avoid all the restrictions of operator() by not adding operator() to the language. Finally, we'll introduce a small library change in C++ that achieves all the benefits we've seen and even more.
---
Zhihao Yuan
Zhihao Yuan is an R&D engineer at Symantec, a Broadcom company, and a PL22.16 representative. In 2018, he wrote the expression auto(x) on his CppCon badge and legalized it in C++ three years later. He rides Bianchi and focuses on avoiding cracks and potholes on Los Angeles roads every day.
---
https://www.accuconference.org/
YouTube Videos Filmed, Edited & Optimised by Digital Medium: https://events.digital-medium.co.uk
#accuconf #programming #cpp
Рекомендуемые видео



















