Packt.Advanced.Cplusplus.1838821139.pdf

-
Title: Advanced C++: Master the technique of confidently writing robust C++ code Author: Brian Price, Gazihan Alankus, Olena Lizina, Rakesh Mane, Vivek Nagarajan Length: 762 pages Edition: 1 Language: English Publisher: Packt Publishing Publication Date: 2019-10-31 ISBN-10: 1838821139 ISBN-13: 97818
Advanced c++ Copyright o 2019 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information Authors: Gazihan alankus, Olena lizina, Rakesh Mane, vivek nagarajan and brian price Technical Reviewers: Anil Achary and Deepak Selvakumar Managing Editor: Bhavesh Bangera Acquisitions Editors: Kunal Sawant, Koushik Sen, and Sneha Shinde Production Editor: Samita Arang Editorial Board: Shubhopriya Banerjee, Bharat Botle, Ewan Buckingham, Mahesh dhyani, Manasa Kumar, alex mazonowicz, Bridget neale dominic pereira Shiny Poojary, Abhisekh Rane, Erol Staveley, Ankita Thakur, Nitesh Thakur, and Jonathan Wray First Published: October 2019 Production Reference: 1311019 ISBN:978-1-83882-113-5 Published by packt Publishing ltd Livery Place, 35 Livery Street Birmingham b 3 2PB, UK Table of contents Preface Chapter 1: anatomy of Portable c++ Software Introduction Managing C++ Projects The code- Build-Test- Run Loop………… 2334 Building a Cmake Project Exercise 1: Using CMake to Generate Ninja Build Files mporting a CMake Project into Eclipse CDt…… 589 EXercise 2: Importing the CMake File into Eclipse CDT Exercise 3: Adding new Source files to CMake and Eclipse CDt 13 Activity1: Adding a New Source- Header File Pair to the Project…………16 Unit Testing Preparing for the Unit Tests…… 17 Exercise4: Preparing Our Project for Unit Testing…………18 Building, Running, and Writing Unit Tests 19 Exercise 5: Building and running tests 20 Exercise 6: Testing the Functionality of Code 26 Activity2: Adding a New Class and Its Test…………… 30 Understanding Compilation, Linking, and object File Contents..... 32 Compilation and Linking Steps ∴32 Exercise 7: Identifying Build Steps 32 The Linking Step……… 39 Diving Deeper; Viewing object Files……… 40 Exercise 8: Exploring compiled Code 灬41 Debugging C++Code…………,…,…,…,…,…,…,…,…,…,…,,…,,…,,…,,…,…,…46 EXercise 9: Debugging with Eclipse CDt 47 Writing Readable Code 56 dentation and Formatting……… 56 Use Meaningful Names as Identifiers,…,,…… 58 Keeping algorithms Clear and Simple 0 EXercise 10: Making Code Readable 62 Activity 3: Making Code More readable..... 66 Summary 68 Chapter 2A: No ducks allowed- Types and deduction ntroduction∴……72 C++ Types…… 73 C++ Fundamental Types 73 C++ Literals灬 Specifying Types-Variables 74 EXercise 1: Declaring Variables and Exploring Sizes 76 Specifying Types - Functions 。鲁鲁自鲁鲁·。。。。 86 Exercise 2: Declaring Functions 88 Pointer Types..... 90 Exercise3: Declaring and Using Pointers……………………………………95 Creating User Types.................................... 99 Enumerations 99 Exercise 4: Enumerations -old and new school ···。···· 104 Structures and classes 107 Fraction class 108 Constructors, Initialization and destructors.. 109 Class special member Functions mplicit Versus Explicit Constructors……………,…,,…,,…,,…,,…………,12 Class special member Functions -Compiler Generation rules 113 Defaulting and Deleting Special Member Functions…………………………13 Rule of three/five and rule of zero ●· ∴1115 Constructors -Initializing the object 115 Exercise 5: Declaring and Initializing Fractions 118 Values versus references and const ggggg 120 Exercise6: Declaring and Using Reference Types………,… 123 Implementing Standard Operators 124 Implementing the Output Stream Operator(<)…………,……………,125 Structuring our Code……,126 Exercise 7: Adding Operators to the Fraction Class 127 Function overloading ng 131 Classes, Structs, and unions∴…132 Activity1: Graphics Processing…… 134 Summary…………,…,…,…,…,……………………,137 Chapter 2B: No Ducks Allowed -Templates and deduction 139 Introduction 140 Inheritance, Polymorphism, and interfaces…………,…,…,,…,,…,140 Inheritance and Access Specifiers………,…,…,…,…,…,…,…,…,,…,…,…,,……,146 Abstract classes and interfaces 146 Exercise1: Implementing Game Characters with Polymorphism………,147 Classes, Structs and Unions Revisited .. 151 Visibility, Lifetime, and Access 152 Namespaces……,…,…,,…,…,…,…,,…,…,,…,,…,…,,…,…,……,…,155 Templates -Generic Programming D鲁。自。。.。。·。。。鲁。。音。。。。。自。。。 156 What is Generic Programming? 157 Introducing C++ Templates 157 C++ Pre-Packaged Templates 159 Type Aliases- typedef and using ,161 Exercise2: Implementing Aliases……… 162 Templates-More than Generic Programming 163 Substitution failure Is not an error-Sfinae 164 Floating-Point Representations 168 Constexpr if Expressions 169 Non-Type Template Arguments ∴170 EXercise 3: Implementing Stringify-specialization Versus constexpr.171 Function Overloading revisited 174 Template Type Deduction 174 Displaying the Deduced Types 175 Template Type Deduction -the Details 176 SF| NAE Expression and Trailing Return Types……………,…,,………183 Class Templates 186 Exercise4: Writing a Class Template…… 186 Activity 1: Developing a Generic"contains"Template Function 190 Summary 191 Chapter 3: No Leaks allowed - Exceptions and resources 193 ntroduction 194 Variable Scope and lifetime ∴194 Exceptions in C++ ∴200 The Need for Exceptions..,..,,..,,,,.,.,,…,,…,…,…,…,200 Stack Unwinding 206 Exercise1: Implementing exceptions in Fraction and Stack……………,206 What Happens When an Exception is Thrown?…… 212 Throw-by-Value or throw-by-Pointer.................... 212 Standard Library Exceptions 213 Catching Exceptions 214 Exercise 2: Implementing Exception Handlers 216 CMake Generator Expressions………………………………,218 Exception Usage guidelines 219 Resource Management (in an Exceptional World)..... 219 Resource acquisition Is Initialization ....................... 220 Exercise3: Implementing RAll for Memory and File Handles……………,223 Special Coding Techniques n226 C++ doesn' Need finally!………………….….…,……………………27 RAll and the stl 227 Who Owns this object? 227 Temporary objects 229 Move semantics∴229 Implementing a Smart Pointer 230 STL Smart Pointers∴ 235 std: unique_ptr…………… 236 std:shared_ptr 237 std:ieak_ptr… 238 Smart Pointers and Calling Functions ∴241 Exercise 4: Implementing RAll with STL Smart Pointers n245 Rule of zero/Five- A Different Perspective…………,…,…,………,………,250 Activity 1: Implementing graphics Processing with RAll and move 252 When is a function called? 253 Which function to call 254 Identifiers 255 Names 255 Name lookup 256 Argument- Dependent Lookup……………,,…,……,…,…,………,256 Caveat Emptor ∴258 Exercise5: mplementing Templates to Prevent ADL Issues……,…,260 Implicit Conversion… 262 Explicit- Preventing Implicit Conversion 262 Contextual Conversion 265 Exercise 6: Implicit and explicit Conversions 266 Activity2: mplementing classes for Date Calculations……………………,270 Summary 271 Chapter 4: Separation of concerns- Software Architecture functions and variadic templates 273 Introduction 274 The pointer to Implementation(PIMPL)Idiom .... n274 ogical and Physical Dependencies……… 274 The Pointer to Implementation(PIMPL)Idiom 276 Advantages and Disadvantages of PIMPL 280 mplementing PIMPL with unique_ptr<>……,…,…,…,…,…,…,…,…,………………280 unique ptr<> PlMPl Special functions 283 Exercise1: Implementing a Kitchen with unique_ptr<>………………………,286 Function Objects and Lambda Expressions…………………………,…290 Function pointers∴ n290 What is a function object? 294 Exercise 2: Implementing function objects……… 297 std: function<> template ∴299 EXercise 3: Implementing callbacks with std: function 302 What is a Lambda Expression? 305 Capturing data into Lambdas…………,…,…,…,…,…,…,…,…,…,……,…,307 Exercise 4: Implementing lambdas 309 Variadic templates 313 Activity 1: Implement a multicast event handler 317 Summary…… 318 Chapter 5: The Philosophers Dinner- Threads and Concurrency 321 ntroduction…322 Synchronous, asynchronous, and threaded execution 323 Concurrency… 323 Parallelism 324 Synchronous Execution.............................. 327 Asynchronous EXecution 330 Exercise1: Creating Threads in a Different Way…………,…,… 336 Review Synchronization Data hazards and race conditions..... 340 Exercise 2: Writing an Example of race conditions 342 Data hazards 346 RAW Dependency 346 WAR Dependency 347 WAW Dependency………,…,…,…,…,…,…,…,…,…,…,,…,…,348 Resource Synchronization…,,.,,…,,,…,…,…,………,,349 Event Synchronization 352 Deadlock ∴355 Move Semantics for Multithreading Closures 356 Exercise3: Moving Objects to a Thread Function………… 359

-
2020-08-19
11.66MB
Advanced C++中文版.pdf
2010-01-20Advanced C++中文版.pdf Advanced C++中文版.pdf
121.89MB
Packt.Building.Computer.Vision.Projects.with.OpenCV.4.and.Cplusplus.2019
2019-05-09Packt.Building.Computer.Vision.Projects.with.OpenCV.4.and.Cplusplus.2019
2.37MB
Packt.Mastering.PostgreSQL10
2018-08-02Packt.Mastering.PostgreSQL.10.2018.1.pdf 很不错的关于postgresql数据库的书籍
11.46MB
Packt.Advanced.Deep.Learning.with.Keras.1788629418.pdf
2019-07-23keras 深度学习高级教程。
30.11MB
Packt.Practical.Game.AI.Programming.2017
2017-07-08Packt.Practical.Game.AI.Programming.2017
18.58MB
Packt.Neural.Network.Programming.with.Tensorflow
2019-01-03Manpreet Singh Ghotra, Rajdeep Dua著基于tensorflow框架深度学习编程书籍,Packt出品易读易学习。
15.0MB
两本Flink英文原版教程-推荐《Packt.Mastering.Apache.Flink》
2019-06-12找到的两本英文教程,《Packt.Mastering.Apache.Flink》和《Stream Processing with Apache Flink》,分别是epub和pdf格式。推荐第一本,代
51.63MB
Packt.Mastering.OpenCV.4.3rd.Edition.2019
2019-05-09Packt.Mastering.OpenCV.4.3rd.Edition.2019.epub
3.98MB
Packt.Linux.Device.Drivers.Development.pdf
2018-09-05Packt.Linux.Device.Drivers.Development.2017 是一本linux驱动开发的好书!基于imx6,设备树,开发,国外经典好书,但是暂时未有翻译版本,此pdf版可以复
11.48MB
Packt.Qt5.Cplusplus.GUI.Programming.Cookbook.2nd.Edition.rar
2019-07-09With the growing need to develop GUIs for multiple targets and multiple screens, improving the visua
11.35MB
Packt.Mastering.Xamarin.Forms.2nd.Edition.2018
2018-04-25Packt.Mastering.Xamarin.Forms.2nd.Edition.2018 Packt.Mastering.Xamarin.Forms.2nd.Edition.2018
17.44MB
Packt.Computer.Vision.with.OpenCV.3.and.Qt5.178847239X.pdf
2018-06-04Packt.Computer.Vision.with.OpenCV.3.and.Qt5.178847239X.pdf
44.19MB
Packt.Python.Beginners.Guide.to.Artificial.Intelligence
2019-01-14Packt.Python.Beginners.Guide.to.Artificial.Intelligence
7.59MB
Packt.Oracle.Database.11gR2.Performance.Tuning.Cookbook.Jan.2012.pdf
2012-02-08Packt.Oracle.Database.11gR2.Performance.Tuning.Cookbook.Jan.2012.pdf
2.78MB
Packt.Design.Patterns.and.Best.Practices.in.Java.9.1786463598.epub.zip
2019-09-07Packt.Design.Patterns.and.Best.Practices.in.Java.9.1786463598 Packt.Design.Patterns.and.Best.Practic
2.6MB
Packt.Linux.Device.Drivers.Development.2017
2017-10-30Packt.Linux.Device.Drivers.Development.2017 Packt.Linux.Device.Drivers.Development.2017
4.54MB
Packt.Mastering.Linux.Kernel.Development.2017
2017-10-30Packt.Mastering.Linux.Kernel.Development.2017 Packt.Mastering.Linux.Kernel.Development.2017
9.69MB
Packt.CentOS.7.Server.Deployment.Cookbook.1783288884
2018-04-19Packt.CentOS.7.Server.Deployment.Cookbook Packt.CentOS.7.Server.Deployment.Cookbook
12.54MB
Packt.Complete.Vue.js.2.Web.Development
2019-01-14Packt.Complete.Vue.js.2.Web.Development
16.23MB
Packt.Python.Machine.Learning.Cookbook.2nd.Edition.2019
2019-05-11Packt.Python.Machine.Learning.Cookbook.2nd.Edition.2019
20.12MB
Packt.OpenGL.Build.high.performance.graphics.2017
2017-06-22Packt.OpenGL.Build.high.performance.graphics.2017
6.46MB
Packt.IntelliJ.IDEA.Essentials.2014
2015-02-12Packt.IntelliJ.IDEA.Essentials.2014
33.36MB
Packt.HBase.High.Performance.Cookbook.rar
2017-09-10Packt.HBase.High.Performance.Cookbook, 包括pdf, azw3,epub,mobi四种格式。我也是下载了错误的格式后,找到的这个版本,希望能对其他人有所帮助。
2.16MB
Packt.PostgreSQL.Cookbook.2015
2015-03-06Packt.PostgreSQL.Cookbook.2015
529KB
Packt.Hands-on.Design.Patterns.with.Kotlin.2018
2018-06-25Packt.Hands-on.Design.Patterns.with.Kotlin.2018 Packt.Hands-on.Design.Patterns.with.Kotlin.2018
21.73MB
Packt.Mastering.Spring.Cloud .pdf .mobi .azw3 .epub
2018-06-06Developing, deploying, and operating cloud applications should be as easy as local applications. Thi
2.78MB
Packt.Bootstrap.4.Cookbook.2017
2017-07-08Packt.Bootstrap.4.Cookbook.2017
1.64MB
Packt.jQuery.Tools.UI.Library
2012-04-22Packt.jQuery.Tools.UI.Library
-
博客
React17 系统精讲 结合TS打造旅游电商平台
React17 系统精讲 结合TS打造旅游电商平台
-
学院
Cocos Creator游戏开发-连连看 (接入腾讯优量汇广告)
Cocos Creator游戏开发-连连看 (接入腾讯优量汇广告)
-
学院
Selenium3分布式与虚拟化
Selenium3分布式与虚拟化
-
博客
浮动布局模型实战应用
浮动布局模型实战应用
-
博客
个人理财第五课-寻找优秀的基金和基金经理人
个人理财第五课-寻找优秀的基金和基金经理人
-
下载
[硕士论文精品]基于FPGA的CPU核及其虚拟平台的设计与实现.pdf
[硕士论文精品]基于FPGA的CPU核及其虚拟平台的设计与实现.pdf
-
学院
FFmpeg4.3黄金系列课程:c++版
FFmpeg4.3黄金系列课程:c++版
-
下载
GlobeLand30中国区域土地利用数据3年完整原始数据(2000-2010-2020)下载地址
GlobeLand30中国区域土地利用数据3年完整原始数据(2000-2010-2020)下载地址
-
博客
PHP深入理解-PHP架构布局
PHP深入理解-PHP架构布局
-
下载
S7-200常用问题.rar
S7-200常用问题.rar
-
博客
网络编程
网络编程
-
下载
PLC编程.rar PLC编程.rar
PLC编程.rar PLC编程.rar
-
学院
第3章 入门程序、常量、变量
第3章 入门程序、常量、变量
-
博客
I/O相关
I/O相关
-
学院
【数据分析-随到随学】互联网行业业务指标及行业数
【数据分析-随到随学】互联网行业业务指标及行业数
-
学院
SubstancePainter插件开发-基础入门
SubstancePainter插件开发-基础入门
-
学院
智联万物,京东IoT技术创新与实践
智联万物,京东IoT技术创新与实践
-
下载
RT809F_20210101.exe
RT809F_20210101.exe
-
学院
C#文件传输、Socket通信、大文件断点续传
C#文件传输、Socket通信、大文件断点续传
-
下载
专利文献信息在技术创新中的应用
专利文献信息在技术创新中的应用
-
下载
bootstrap-4.0.0.zip
bootstrap-4.0.0.zip
-
博客
迈向高级的Java面试突围课
迈向高级的Java面试突围课
-
博客
MySql系列01:MySql介绍及安装
MySql系列01:MySql介绍及安装
-
博客
STM32——PS2遥控手柄
STM32——PS2遥控手柄
-
下载
Hardwares虚拟硬件工具.rar
Hardwares虚拟硬件工具.rar
-
博客
Codeforces Round #696 (Div. 2) C. Array Destruction
Codeforces Round #696 (Div. 2) C. Array Destruction
-
学院
android笔试面试和实战课程
android笔试面试和实战课程
-
学院
Kotlin协程极简入门与解密
Kotlin协程极简入门与解密
-
博客
Macbook M1 安装node(亲测)
Macbook M1 安装node(亲测)
-
学院
【数据分析-随到随学】Spark理论及实战
【数据分析-随到随学】Spark理论及实战