smzztx / cppprimer_5th_cn Goto Github PK
View Code? Open in Web Editor NEW《C++ Primer(第五版)》习题答案笔记
Home Page: https://blog.csdn.net/shamozhizhoutx/article/details/81264498
《C++ Primer(第五版)》习题答案笔记
Home Page: https://blog.csdn.net/shamozhizhoutx/article/details/81264498
28题swap 后面少了一个 noexcept
会导致调用 左值版本的operator=
最终出现:“调用删除的函数”
链接:
https://blog.csdn.net/shamozhizhoutx/article/details/90524494#comments_26584841
对练习12.31,《C++ Primer习题集》上给出的答案为vector更优,原文如下:“ 对这个问题而言,vector 更好。因为,虽然vector 不会维护元素值的序,set 会维护关键字的序,但注意到,我们是逐行读取输入文本的,因此每个单词出现的行号是自然按升序加入到容器中的,不必特意用关联容器来保证行号的升序。而从性能角度,set是基于红黑树实现的,插入操作时间复杂性为0(log n) (n为容器中元素数目),而vector的 push back 可达到常量时间。
另外,一个单词在同一行中可能出现多次。set 自然可保证关键字不重复,但对 vector 这也不成为障碍一一每次添加行号前与最后一个行号比较一下即可。总体性能仍然是vector更优。”
链接:
https://blog.csdn.net/shamozhizhoutx/article/details/83056020#comments_23214236
RT.
链接(Dy1280257539):
https://blog.csdn.net/shamozhizhoutx/article/details/82291127
RT.
链接(JasmineFeng):
https://blog.csdn.net/shamozhizhoutx/article/details/82731081
练习4.11 a >=b 应该为 a > b 练习4.15 pi改为*pi 练习4.16 if((p = getPtr() != 0);-> if((p = getPtr()) != 0);少了个右括号 练习4.36 i *= static_cast(d) 改为 static_cast(d).4.37也一样
提问链接:https://blog.csdn.net/shamozhizhoutx/article/details/81879200#comments_20058993
对练习12.31,《C++ Primer习题集》上给出的答案为vector更优,原文如下:“ 对这个问题而言,vector 更好。因为,虽然vector 不会维护元素值的序,set 会维护关键字的序,但注意到,我们是逐行读取输入文本的,因此每个单词出现的行号是自然按升序加入到容器中的,不必特意用关联容器来保证行号的升序。而从性能角度,set是基于红黑树实现的,插入操作时间复杂性为0(log n) (n为容器中元素数目),而vector的 push back 可达到常量时间。
另外,一个单词在同一行中可能出现多次。set 自然可保证关键字不重复,但对 vector 这也不成为障碍一一每次添加行号前与最后一个行号比较一下即可。总体性能仍然是vector更优。”
链接:
https://blog.csdn.net/shamozhizhoutx/article/details/83056020#comments_23214236
RT.
链接(Y_CDSN_):
https://blog.csdn.net/shamozhizhoutx/article/details/81879200
a.没有实例化,因为只是声明。
b.没有实例化,引用和指针不需要实例化
e.实例化,调用时需要实例化
链接:
https://blog.csdn.net/shamozhizhoutx/article/details/90524494#comments_25737750
RT.
链接(Y_CDSN_):
https://blog.csdn.net/shamozhizhoutx/article/details/82263038
要写成const char* 才可以通过
是vs2022
链接:
https://blog.csdn.net/shamozhizhoutx/article/details/82731081#comments_27605849
RT.
链接如下(Y_CDSN_):
https://blog.csdn.net/shamozhizhoutx/article/details/82263038
应该是调用的base中的name.基类用派生类构造,base类调用的静态依旧是base的.(打断点调试出来是base的)
链接:
https://blog.csdn.net/shamozhizhoutx/article/details/90543021#comments_20561601
练习5.7 (a).ival1=ival2 少了分号 (b).多了undefined
提问链接:https://blog.csdn.net/shamozhizhoutx/article/details/82082116#comments_20064483
RT.
链接(Y_CDSN_):
https://blog.csdn.net/shamozhizhoutx/article/details/82263038
6.37 第四行auto fun(std::string (&arrs)[10]) -> std::string (&)[10]);多了个括号应该是auto fun(std::string (&arrs)[10]) -> std::string (&)[10];
链接(Y_CDSN_):
https://blog.csdn.net/shamozhizhoutx/article/details/82263038#comments_22733216
decltype(odd)& arrPtr(int i)
{
return (i % 2) ? odd : even;
}
链接(Y_CDSN_):
https://blog.csdn.net/shamozhizhoutx/article/details/82263038
RT.
链接(Y_CDSN_):
https://blog.csdn.net/shamozhizhoutx/article/details/82082116
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.