|
Library of Assembled Shared Sources
|
Wrapper to type-hint a return value as Self.
More...
#include <self.h>
Public Member Functions | |
| T & | reference () |
| Return reference to wrapped value. | |
| const T & | reference () const |
| Return reference to wrapped value. | |
Wrapper to type-hint a return value as Self.
This is helpful for virtual methods that return an object of the same type as the this pointer. Here's an example with a clone method:
This will make sure the type-hint of Spam will look like:
See typing.Self and PEP 673 for more info.