b*i
2 楼
C++里面,如果有一个函数
const int foo()
{
return 5;
}
或者是一个对象
const Object bar()
{
...
}
这里const干啥用的?
我同事说只能赋值给常值变量,比如const int i = foo();但是我试了,好像可以随便。
我觉得他和 const Obj& obj = bar_();混了,如果是返回一个引用。这个时候我们不
希望变量随便改写引用的内容。
const int foo()
{
return 5;
}
或者是一个对象
const Object bar()
{
...
}
这里const干啥用的?
我同事说只能赋值给常值变量,比如const int i = foo();但是我试了,好像可以随便。
我觉得他和 const Obj& obj = bar_();混了,如果是返回一个引用。这个时候我们不
希望变量随便改写引用的内容。
l*s
4 楼
奇葩
d*z
9 楼
都是你们整天炫耀惹的
h*l
18 楼
For user-defined type, it is okay to assign to r-value, as the assignment
operator defined by the user may do something useful. It is probably not
a good practice though, but c++ standard committee may just want to allow
maximum flexibility.
Generally if we want to disable bizarre assignment statement like a+b=c or a
*b=c for user defined type, write operator+ (operator*) overload method to
return const. The disadvantage is that if a+b or a*b is used as a function
argument, they can not be bound to parameter of r-value reference type, thus
move is not allowed.
【在 b*****e 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: foo 是一个返回 const int 的函数。
: 这 const 是多余的。因为return 的东西是 r-value, 本来就不能改。
: 如果是 const char * 或者 const char &, 这里的const 是修饰char, 而不是
: 整个return type, 所以不是多余的。
: 也可以写成 char const * 或者 char const &.
d*z
27 楼
我有个套子本来是用NOOK的,后来发现7寸本子也可以塞进去,刚才试了一下K3竟然也
正好跟定做的一样,真是神套!
正好跟定做的一样,真是神套!
t*n
31 楼
http://www.amazon.com/Belkin-Neoprene-Kindle-Display-Generation
我买的是这个套子,基本上什么6"的电子书阅读器都能装
【在 d****z 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: FT,你自己找个套子试试看,不用自己改动就能通吃的还真不多
:
: 碗!
我买的是这个套子,基本上什么6"的电子书阅读器都能装
【在 d****z 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: FT,你自己找个套子试试看,不用自己改动就能通吃的还真不多
:
: 碗!
d*z
32 楼
你这个是袋子啊,我的是正儿八经的套子
【在 t******n 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: http://www.amazon.com/Belkin-Neoprene-Kindle-Display-Generation
: 我买的是这个套子,基本上什么6"的电子书阅读器都能装
【在 t******n 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: http://www.amazon.com/Belkin-Neoprene-Kindle-Display-Generation
: 我买的是这个套子,基本上什么6"的电子书阅读器都能装
d*z
33 楼
有图有真相,神套
【在 t******n 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: http://www.amazon.com/Belkin-Neoprene-Kindle-Display-Generation
: 我买的是这个套子,基本上什么6"的电子书阅读器都能装
【在 t******n 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: http://www.amazon.com/Belkin-Neoprene-Kindle-Display-Generation
: 我买的是这个套子,基本上什么6"的电子书阅读器都能装
相关阅读
Naughty String (转载)百度太无耻了前辈在上Georgia Tech Online Master吗?小弟这学期才开始陆奇担任百度集团总裁兼首席运营官 (转载)今天跟乌克兰白牛一起干活,快流鼻血了一层卷积很容易理解...有个streaming要做实时closed caption,IBM家watson靠谱不spring 5 变化很大啊数据库小白请教:如果数据库文件很大,MySQL和Python Pandas分卷积这东西真神了Google got it wrong. The open-office trend is destroying the workplace.请教一个巨难的angular/node问题:下载gpg文件ERR_CONTENT_DECanyone interested in financial analytic/statisticsgithub挂了大数据时代 (转载)请教一个简单的java问题Python vs Juliapython 3 lazy evaluate 改起来麻烦没有博士学位,应该搞vision吗?俺公司J2EE 的business logic 都在数据库里面搞