aui::no_escape#
A funcntion contract that does not allow escaping, allowing to accept lvalue ref, rvalue ref, shared_ptr and etc without overhead
Header: | #include <AUI/Traits/values.h> |
CMake: | aui_link(my_target PUBLIC aui::core) |
Detailed Description#
Promises that the contained object wouldn't be copied/moved/referenced outside the function where the no_escape came to; thus does not take responsibility of deleting the object. This allows to accept any kind of lifetimes: lvalue and rvalue references, pointers, unique_ptr and shared_ptr without ref counter modification.
Intended to use in function arguments.
Accepts lvalue ref, rvalue ref, ptr and shared_ptr. Does not accepts null.
Examples#
examples/7guis/cells/src/Tokens.h
7GUIs Cells - Spreadsheet processor (Excel).
};
using Any = std::variant<Identifier, Double, Semicolon, LPar, RPar, Colon, Plus, Minus, Asterisk, Slash, LAngle, RAngle, StringLiteral>;
AVector<token::Any> parse(aui::no_escape<ATokenizer> t);
} // namespace token
examples/7guis/cells/src/Tokens.cpp
7GUIs Cells - Spreadsheet processor (Excel).