-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not bother with the
CanBindTo
optimization in MakerType{,For}
.
The optimization is important in `Initializer` constructed from an already constructed object, but it is rare to explicitly wrap constructor arguments in a way can benefit from copy elision. `MakerType{,For}::Reference()` is still useful to support `Initializer::Reference()`, and is compatible with immovable types before C++17 which guarantees copy elision. If copy elision is guaranteed and `storage` is not provided, `MakerType{,For}::Reference()` returns the result by value instead of by reference, which is a more efficient way to construct the temporary. Rename `internal::CanBindTo` to `internal::CanBindReference`, and limit it to a single argument case which remains used. Add `internal::BindReference()` function template, and use it to implicitly convert references instead of applying the pointer hack where `CanBindReference` is used (needed because not all compilers implement http://wg21.link/cwg2352). PiperOrigin-RevId: 686644549
- Loading branch information
Showing
3 changed files
with
100 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters