📜  c++代码示例中的自动&

📅  最后修改于: 2022-03-11 14:44:53.709000             🧑  作者: Mango

代码示例1
Use auto && for the ability to modify and discard values of the sequence within the loop. (That is, unless the container provides a read-only view, such as std::initializer_list, in which case it will be effectively an auto const &.)
    Use auto & to modify the values of the sequence in a meaningful way.
    Use auto const & for read-only access.
    Use auto to work with (modifiable) copies.