|
|
|
|
|
by purplesyringa
275 days ago
|
|
> Lifetime parameters aren't necessary, lifetime contracts may be implemented in a different and much easier way. This may be expressed in form of a function attribute, which may be calculated via constexpr code. Wouldn't that just be slightly different syntax for the same idea? If you want to represent relationships like "the pointer in the field Struct::field_name within this argument is linked with the lifetime of the returned pointer" and you want them to be reusable across functions and contexts, isn't the most obvious way to write that a variant of struct Struct<'a> {
char *'a field_name;
};
char *'a f<'a>(Struct<'a>& struct);
?
|
|