View source code
Display the source code in dmd/expressionsem.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aGitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.

Function dmd.expressionsem.canElideCopy

Determine if copy elision is allowed when copying an expression to a typed storage. This basically elides a restricted subset of so-called "pure" rvalues, i.e. expressions with no reference semantics.

bool canElideCopy(
  Expression e,
  Type to,
  bool checkMod = false
);

Note

Please avoid using checkMod parameter because canElideCopy() essentially defines a value category and should eventually be merged with isLvalue() to return [isLvalue, allowEmplacement]. Checking type compatibility here is only a stopgap measure.

Authors

Walter Bright

License

Boost License 1.0