▶Book Description
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.
▶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
▶Key Features
- 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
This book is intended for all C++ developers, regardless of their experience level. The typical reader is an entry- or medium-level C++ developer who wants to master the language and become a prolific modern C++ developer. The experienced C++ developer will find a good reference for many C++11, C++14, and C++17 language and library features that may come in handy from time to time. The book consists of more than one hundred recipes that are simple, intermediate, or advanced. However, they all require prior knowledge of C++, and
that includes functions, classes, templates, namespaces, macros, and others. Therefore, if you are not familiar with the language, it is recommended that you first read an introductory book to familiarize yourself with the core aspects, and then proceed with this book.
▶What this book covers
- Chapter 1, Learning Modern Core Language Features, teaches you about modern core language features including type inference, uniform initialization, scoped enums, rangebased for loops, structured bindings, and others.
- Chapter 2, Working with Numbers and Strings, discusses how to convert between numbers and strings, generate pseudo-random numbers, work with regular expressions, and various types of string.
- Chapter 3, Exploring Functions, dives into defaulted and deleted functions, variadic templates, lambda expressions, and higher-order functions.
- Chapter 4, Preprocessor and Compilation, takes a look at various aspects of compilation, from how to perform conditional compilation, to compile-time assertions, code generation, or hinting the compiler with attributes.
- Chapter 5, Standard Library Containers, Algorithms, and Iterators, introduces you to several standard containers, many algorithms, and teaches you how to write your own random access iterator.
- Chapter 6, General Purpose Utilities, dives into the chrono library; the any, optional, and variant types; and learn about type traits.
- Chapter 7, Working with Files and Streams, explains how to read and write data to/from streams, use I/O manipulators to control streams, and explores the filesystem library.
- Chapter 8, Leveraging Threading and Concurrency, informs you how to work with threads, mutexes, locks, condition variables, promises, futures, and atomic types.
- Chapter 9, Robustness and Performance, focuses on exceptions, constant correctness, type casts, smart pointers, and move semantics.
- Chapter 10, Implementing Patterns and Idioms, covers various useful patterns and idioms, such as the pimpl idiom, the non-virtual interface idiom, or the curiously recurring template pattern.
- Chapter 11, Exploring Testing Frameworks, helps you get a kickstart with three of the most widely used testing frameworks, Boost.Test, Google Test, and Catch.