memesearch
Take Parameters Properly

Take Parameters Properly

Download Find similar pictures
Text on the meme
23. Take parameters properly Effective use of C++ is x a raw memory address START HERE use a raw pointer is x an invocable try in this order: std::invocable<Args...> auto&& x return_t(*)(Args...) std::invocable<...> auto&& x std::function&& return_t(Args...)> x does x need to be perfectly forwarded take by universal reference if x is a range if x is a readonly string take std::string does x need to be a contiguous array take std::span can x be an arbitrary range take std::ranges::... does x need to be a specific container take the container take iterator pair if x can be null take std::optional of x if needing ownership of x take std::string if x is moved from take by value reference if x is copied take by value if x is modified take by value if x is cheap to copy take by value otherwise take by const value reference
What it means

На изображении показана юмористическая блок-схема «Take parameters properly» об эффективном использовании C++. Она перечисляет множество вариантов передачи параметров в C++: указатель, универсальная ссылка, std::optional, std::span, контейнер или передача по значению. Шутка в том, что выбор правильного способа передачи параметра превращён в чрезмерно сложное дерево решений.

Objects
Tags
Source
Type
image
Size
800×448 · 69.7 KiB
Mood
саркастичный, абсурдный
Language
en
Added