0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C++ - auto&& vs auto& vs auto

Last updated at Posted at 2018-09-20

C++ is difficult...T_T

  • Choose auto x when you want to work with copies.
  • Choose auto &x when you want to work with original items and may modify them.
  • Choose auto const &x when you want to work with original items and will not modify them.
  • Use auto && is a Universal Reference.

https://stackoverflow.com/questions/29859796/c-auto-vs-auto
https://zhuanlan.zhihu.com/p/25148592

2018/11/06 Updated

I found this and explained very detail.
http://tommyjswu-blog.logdown.com/posts/1766009-c-11-mouth-cannon-universal-reference-rvalue-reference-and-move-semantics

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?