'auto const'和'const auto'是否相同? [英] Is 'auto const' and 'const auto' the same?

查看:988
本文介绍了'auto const'和'const auto'是否相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

auto constconst 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.

这篇关于'auto const'和'const auto'是否相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆