、APIをより理解しやすくするための例です:C++ const修飾の多くの利点の中で右辺値参照とのconst修飾子
template<typename T> int function1(T const& in);
// clearly, the input won’t change through function1
右辺値参照の導入に伴い、1は完全な転送の恩恵を受けることが多いのconst修飾子することができます例:
template<typename T> int function2(T&& in);
// can explicitly forward the input if it's an rvalue
function2が入力を変更しないことを説明する良い方法はありますか?
他の人にパラメータを転送しているだけの場合、 'const'とは何を気にしていますか?あなたは彼らにそれに対処させます。 –