'auto const'和'const auto'是否相同?
问题描述:
auto const
和const auto
之间是否存在语义上的区别,或者它们是同一意思?
Is there a semantic difference between auto const
and const auto
, or do they mean the same thing?
答
const
限定词适用于紧靠左侧的类型,除非左侧没有任何内容,则它适用于紧靠右侧的类型.是的,是一样的.
The const
qualifier applies to the type to the immediate left unless there is nothing to the left then it applies to the type to the immediate right. So yup it's the same.