读书人

哪位能介绍一下C++14, 小弟我顺便就给

发布时间: 2013-09-28 10:01:20 作者: rapoo

哪位能介绍一下C++14, 我顺便就给未来7OR9天长假散粉了
哪位能介绍一下C++14, 我顺便就给未来 7||9 天长假散粉了

哪位能介绍一下C++14, 小弟我顺便就给未来7OR9天长假散粉了

现在是处在有点尴尬的了!
[解决办法]
wiki 啊,http://en.wikipedia.org/wiki/C%2B%2B14.
[解决办法]
我相当怀疑这样改下去,以后编译器报错的地方到底能不能看懂了。。
[解决办法]
盲目升级是码农之殇!
[解决办法]
升级是只是给部分C++使用者使用的
有的公司提倡用BOOST,有的连模板的很少用,程序员的理解的C++知识差距也越来越大......
再这么下去,我都不敢说自己是C++程序员了



谁能翻译下C++11标准,我网购... (好吧,自己不努力,也只能晒死在沙滩上了)
[解决办法]
虽然标准越来越长,旧的一些东西已经不建议使用了。

比较典型的就是
C++ Primer 第三版 1033页
C++ Primer 第四版 900页
C++ Primer 第五版 848页
[解决办法]


[解决办法]
哪位能介绍一下C++14, 小弟我顺便就给未来7OR9天长假散粉了
接分
[解决办法]
引用:
C++这是作死的节奏?

刚好相反,c++是越改越简单
新标准其实简化了很多难用的老技术
例如c++11的lambda让stl好用非常多
c++14的polymorphic lambda则强化了c++11的lambda

c++11

std::transform(std::begin(a), std::end(a), std::begin(b), [](int a){return a + 50;});


c++14

std::transform(std::begin(a), std::end(a), std::begin(b), [](auto a){return a + 50;});


这一来,以后a的type改变的时候,我们就不用连lambda都一起改了
说穿了,那个auto就是一个template parameter而已
这是一个本来就该有的功能,c++11碍于一些技术障碍没来得及加进去

引用:
我相当怀疑这样改下去,以后编译器报错的地方到底能不能看懂了。。

这你不用担心,错误讯息只会越来越容易阅读
c++的concepts有了很大的进展,最迟应该在c++17就会引入
以后我们再也不用学习如何解读那犹如密码般难读的错误讯息

不管那一门语言,随着发展标准一定是越来越厚的
时代在变,语言也在进化
就连c也是一直在扩充和改变

你问问看身边的人有谁懂c11多了什么东西?
为何?因为懒惰啊,新东西出来了又要重学
我又重“自以为的专家”降级成新手?
他们可不愿意花这些时间
只好拼命贬低新的发明了
[解决办法]
引用:


好吧。。高手,那你帮我说说,这一条是不是属于瞎折腾的:

Function return type deduction[edit source
[解决办法]
editbeta]
C++11 allowed lambda functions to deduce the return type based on the type of the expression given to the return statement. C++14 provides this ability to all functions. It also extends these facilities to lambda functions, allowing return type deduction for functions that are not of the form return expression;.[6]
In order to induce return type deduction, the function must be declared with auto as the return type, but without the trailing return type specifier in C++11:


auto DeduceReturnType(); // Return type to be determined.
If multiple return expressions are used in the function's implementation, then they must all deduce the same type.[7]
Functions that deduce their return types can be forward declared, but they cannot be used until they have been defined. Their definitions must be available to the translation unit that uses them.
Recursion can be used with a function of this type, but the recursive call must happen after at least one return statement in the definition of the function:[7]
auto Correct(int i) {
if (i == 1)
return i; // return type deduced as int
else
return Correct(i-1)+i; // ok to call it now
}

auto Wrong(int i)
{
if(i != 1)
return Wrong(i-1)+i; // Too soon to call this. No prior return statement.
else
return i; // return type deduced as int
}

读书人网 >C++

热点推荐