万本电子书0元读

万本电子书0元读

顶部广告

Modern C++ Programming Cookbook电子书

售       价:¥

18人正在读 | 0人评论 6.2

作       者:Marius Bancila

出  版  社:Packt Publishing

出版时间:2017-05-15

字       数:75.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Over 100 recipes to help you overcome your difficulties with C++ programming and gain a deeper understanding of the working of modern C++ About This Book ? Explore the most important language and library features of C++17, including containers, algorithms, regular expressions, threads, and more, ? Get going with unit testing frameworks Boost.Test, Google Test and Catch, ? Extend your C++ knowledge and take your development skills to new heights by making your applications fast, robust, and scalable. Who This Book Is For If you want to overcome difficult phases of development with C++ and leverage its features using modern programming practices, then this book is for you. The book is designed for both experienced C++ programmers as well as people with strong knowledge of OOP concepts. What You Will Learn ? Get to know about the new core language features and the problems they were intended to solve ? Understand the standard support for threading and concurrency and know how to put them on work for daily basic tasks ? Leverage C++’s features to get increased robustness and performance ? Explore the widely-used testing frameworks for C++ and implement various useful patterns and idioms ? Work with various types of strings and look at the various aspects of compilation ? Explore functions and callable objects with a focus on modern features ? Leverage the standard library and work with containers, algorithms, and iterators ? Use regular expressions for find and replace string operations ? Take advantage of the new filesystem library to work with files and directories ? Use the new utility additions to the standard library to solve common problems developers encounter including string_view, any , optional and variant types In Detail C++ is one of the most widely used programming languages. Fast, efficient, and flexible, it is used to solve many problems. The latest versions of C++ have seen programmers change the way they code, giving up on the old-fashioned C-style programming and adopting modern C++ instead. Beginning with the modern language features, each recipe addresses a specific problem, with a discussion that explains the solution and offers insight into how it works. You will learn major concepts about the core programming language as well as common tasks faced while building a wide variety of software. You will learn about concepts such as concurrency, performance, meta-programming, lambda expressions, regular expressions, testing, and many more in the form of recipes. These recipes will ensure you can make your applications robust and fast. By the end of the book, you will understand the newer aspects of C++11/14/17 and will be able to overcome tasks that are time-consuming or would break your stride while developing. Style and approach This book follows a recipe-based approach, with examples that will empower you to implement the core programming language features and explore the newer aspects of C++.
目录展开

Title Page

Copyright

Credits

About the Author

About the Reviewer

www.PacktPub.com

Customer Feedback

Preface

Sections

Getting ready

How to do it…

How it works…

There's more…

See also

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

Learning Modern Core Language Features

Introduction

Using auto whenever possible

How to do it...

How it works...

See also

Creating type aliases and alias templates

How to do it...

How it works...

Understanding uniform initialization

Getting ready

How to do it...

How it works...

There's more

See also

Understanding the various forms of non-static member initialization

How to do it...

How it works...

Controlling and querying object alignment

Getting ready

How to do it...

How it works...

Using scoped enumerations

How to do it...

How it works...

Using override and final for virtual methods

Getting ready

How to do it...

How it works...

Using range-based for loops to iterate on a range

Getting ready

How to do it...

How it works...

See also

Enabling range-based for loops for custom types

Getting ready

How to do it...

How it works...

See also

Using explicit constructors and conversion operators to avoid implicit conversion

Getting ready

How to do it...

How it works...

See also

Using unnamed namespaces instead of static globals

Getting ready

How to do it...

How it works...

See also

Using inline namespaces for symbol versioning

Getting ready

How to do it...

How it works...

See also

Using structured bindings to handle multi-return values

Getting ready

How to do it...

How it works...

Working with Numbers and Strings

Introduction

Converting between numeric and string types

Getting ready

How to do it...

How it works...

See also

Limits and other properties of numeric types

Getting ready

How to do it...

How it works...

Generating pseudo-random numbers

Getting ready

How to do it...

How it works...

See also

Initializing all bits of internal state of a pseudo-random number generator

Getting ready

How to do it...

How it works...

Creating cooked user-defined literals

Getting ready

How to do it...

How it works...

There's more...

See also

Creating raw user-defined literals

Getting ready

How to do it...

How it works...

See also

Using raw string literals to avoid escaping characters

Getting ready

How to do it...

How it works...

See also

Creating a library of string helpers

Getting ready

How to do it...

How it works...

See also

Verifying the format of a string using regular expressions

Getting ready

How to do it...

How it works...

There's more...

See also

Parsing the content of a string using regular expressions

Getting ready

How to do it...

How it works...

See also

Replacing the content of a string using regular expressions

Getting ready

How to do it...

How it works...

See also

Using string_view instead of constant string references

Getting ready

How to do it...

How it works...

See also

Exploring Functions

Introduction

Defaulted and deleted functions

Getting started

How to do it...

How it works...

Using lambdas with standard algorithms

Getting ready

How to do it...

How it works...

There's more...

See also

Using generic lambdas

Getting started

How to do it...

How it works...

See also

Writing a recursive lambda

Getting ready

How to do it...

How it works...

Writing a function template with a variable number of arguments

Getting ready

How to do it...

How it works...

See also

Using fold expressions to simplify variadic function templates

Getting ready

How to do it...

How it works...

There's more...

See also

Implementing higher-order functions map and fold

Getting ready

How to do it...

How it works...

There's more...

See also

Composing functions into a higher-order function

Getting ready

How to do it...

How it works...

There's more...

See also

Uniformly invoking anything callable

Getting ready

How to do it...

How it works...

See also

Preprocessor and Compilation

Introduction

Conditionally compiling your source code

Getting ready

How to do it...

How it works...

See also

Using the indirection pattern for preprocessor stringification and concatenation

Getting ready

How to do it...

How it works...

See also

Performing compile-time assertion checks with static_assert

Getting ready

How to do it...

How it works...

See also

Conditionally compiling classes and functions with enable_if

Getting ready

How to do it...

How it works...

There's more...

See also

Selecting branches at compile time with constexpr if

Getting ready

How to do it...

How it works...

Providing metadata to the compiler with attributes

How to do it...

How it works...

Standard Library Containers, Algorithms, and Iterators

Introduction

Using vector as a default container

Getting ready

How to do it...

How it works...

There's more...

See also

Using bitset for fixed-size sequences of bits

Getting ready

How to do it...

How it works...

There's more...

See also

Using vector<bool> for variable-size sequences of bits

Getting ready...

How to do it...

How it works...

There's more...

See also

Finding elements in a range

Getting ready

How to do it...

How it works...

There's more...

See also

Sorting a range

Getting ready

How to do it...

How it works...

There's more...

See also

Initializing a range

Getting ready

How to do it...

How it works...

See also

Using set operations on a range

Getting ready

How to do it...

How it works...

See also

Using iterators to insert new elements in a container

Getting ready

How to do it...

How it works...

There's more...

See also

Writing your own random access iterator

Getting ready

How to do it...

How it works...

There's more...

See also

Container access with non-member functions

Getting ready

How to do it...

How it works...

There's more...

See also

General Purpose Utilities

Introduction

Expressing time intervals with chrono::duration

Getting ready

How to do it...

How it works...

There's more...

See also

Measuring function execution time with a standard clock

Getting ready

How to do it...

How it works...

See also

Generating hash values for custom types

Getting ready

How to do it...

How it works...

Using std::any to store any value

Getting ready

How to do it...

How it works...

See also

Using std::optional to store optional values

Getting ready

How to do it...

How it works...

See also

Using std::variant as a type-safe union

Getting ready

How to do it...

How it works...

There's more...

See also

Visiting a std::variant

Getting ready

How to do it...

How it works...

See also

Registering a function to be called when a program exits normally

Getting ready

How to do it...

How it works...

See also

Using type traits to query properties of types

Getting ready

How to do it...

How it works...

There's more...

See also

Writing your own type traits

Getting ready

How to do it...

How it works...

See also

Using std::conditional to choose between types

Getting ready

How to do it...

How it works...

See also

Working with Files and Streams

Introduction

Reading and writing raw data from/to binary files

Getting ready

How to do it...

How it works...

There's more...

See also

Reading and writing objects from/to binary files

Getting ready

How to do it...

How it works...

See also

Using localized settings for streams

Getting ready

How to do it...

How it works...

See also

Using I/O manipulators to control the output of a stream

Getting ready

How to do it...

How it works...

See also

Using monetary I/O manipulators

Getting ready

How to do it...

How it works...

See also

Using time I/O manipulators

Getting ready

How to do it...

How it works...

See also

Working with filesystem paths

Getting ready

How to do it...

How it works...

See also

Creating, copying, and deleting files and directories

Getting ready

How to do it...

How it works...

See also

Removing content from a file

Getting ready

How to do it...

How it works...

See also

Checking the properties of an existing file or directory

Getting ready

How to do it...

How it works...

See also

Enumerating the content of a directory

Getting ready

How to do it...

How it works...

There's more...

See also

Finding a file

Getting ready

How to do it...

How it works...

See also

Leveraging Threading and Concurrency

Introduction

Working with threads

Getting ready

How to do it...

How it works...

See also

Handling exceptions from thread functions

Getting ready

How to do it...

How it works...

See also

Synchronizing access to shared data with mutexes and locks

Getting ready

How to do it...

How it works...

See also

Avoiding using recursive mutexes

Getting ready

How to do it...

How it works...

See also

Sending notifications between threads

Getting ready

How to do it...

How it works...

See also

Using promises and futures to return values from threads

Getting ready

How to do it...

How it works...

There's more...

See also

Executing functions asynchronously

Getting ready

How to do it...

How it works...

See also

Using atomic types

Getting ready

How to do it...

How it works...

See also

Implementing parallel map and fold with threads

Getting ready

How to do it...

How it works...

See also

Implementing parallel map and fold with tasks

Getting ready

How to do it...

How it works...

There's more...

See also

Robustness and Performance

Introduction

Using exceptions for error handling

Getting ready

How to do it...

How it works...

There's more...

See also

Using noexcept for functions that do not throw

How to do it...

How it works...

There's more...

See also

Ensuring constant correctness for a program

How to do it...

How it works...

There's more...

See also

Creating compile-time constant expressions

Getting ready

How to do it...

How it works...

See also

Performing correct type casts

How to do it...

How it works...

There's more...

See also

Using unique_ptr to uniquely own a memory resource

Getting ready

How to do it...

How it works...

See also

Using shared_ptr to share a memory resource

Getting ready

How to do it...

How it works...

See also

Implementing move semantics

Getting ready

How to do it...

How it works...

There's more...

See also

Implementing Patterns and Idioms

Introduction

Avoiding repetitive if...else statements in factory patterns

Getting ready

How to do it...

How it works...

There's more...

See also

Implementing the pimpl idiom

Getting ready

How to do it...

How it works...

There's more...

See also

Implementing the named parameter idiom

Getting ready

How to do it...

How it works...

See also

Separating interfaces and implementations with the non-virtual interface idiom

Getting ready

How to do it...

How it works...

See also

Handling friendship with the attorney-client idiom

Getting ready

How to do it...

How it works...

There's more

See also

Static polymorphism with the curiously recurring template pattern

Getting ready

How to do it...

How it works...

There's more...

See also

Implementing a thread-safe singleton

Getting ready

How to do it...

How it works...

There's more...

See also

Exploring Testing Frameworks

Introduction

Getting started with Boost.Test

Getting ready

How to do it...

How it works...

There's more...

See also

Writing and invoking tests with Boost.Test

Getting ready

How to do it...

How it works...

See also

Asserting with Boost.Test

Getting ready

How to do it...

How it works...

There's more...

See also

Using fixtures in Boost.Test

Getting ready

How to do it...

How it works...

See also

Controlling outputs with Boost.Test

Getting ready

How to do it...

How it works...

There's more...

See also

Getting started with Google Test

Getting ready

How to do it...

How it works...

There's more...

See also

Writing and invoking tests with Google Test

Getting ready

How to do it...

How it works...

See also

Asserting with Google Test

How to do it...

How it works...

See also

Using text fixtures with Google Test

Getting ready

How to do it...

How it works...

See also

Controlling output with Google Test

Getting ready

How to do it...

How it works...

See also

Getting started with Catch

Getting ready

How to do it...

How it works...

There's more...

See also

Writing and invoking tests with Catch

How to do it...

How it works...

See also

Asserting with Catch

Getting ready

How to do it...

How it works...

See also

Controlling output with Catch

Getting ready

How to do it...

How it works...

See also

Bibliography

Articles and books

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部