[SAoC] Move semantics and STL containers
Suleyman
sahmi.soulaimane at gmail.com
Sat Sep 28 11:06:02 UTC 2019
Week 2 status:
- `@rvalue ref` attribute:
- `auto @rvalue ref` for function parameters expands to
either `ref` or `@rvalue ref`
- `auto ref` for function parameters retains its current
behaviour
- `auto ref` on function returns infers refness properly
between `ref`, `@rvalue ref`, and no ref.
- `@rvalue` or `__rvalue` as a type constructor[1]:
- grammar definition[2]
- enable both syntaxes `@rvalue` and `__rvalue`
- only usable with ref or with pointers
- ability to cast to or from `@rvalue`
- implicit conversion to or from `@rvalue` allowed except
with pointers
- special behaviour with function calls where rvalue
arguments are implicitly `@rvalue` while lvalues need an explicit
cast
- `@rvalue` ref is overloadable with bare ref
- recognized as a type specialization with `is(T ==
@rvalue)`
- D and C++ name mangling
- works with ctfe, inliner, optimizer, and escape analysis
____
[1] https://github.com/dlang/dmd/pull/10426
[2] https://github.com/dlang/dlang.org/pull/2704
More information about the Digitalmars-d
mailing list