- A C++ function with a const reference formal argument and a nonmatching actural argument mimics the traditional passing by value behavior, generating a temporary variable to hold the value and guaranteeing that the original data is unaltered.
- Temporary variables cause no harm and make the function more general in the sorts of arguments it can handle.
Tempory Variables, Reference Arguments, and const
最新推荐文章于 2021-11-09 04:50:52 发布