My Account Log in

2 options

C++17 STL cookbook : over 90 recipes that leverage the powerful features of the standard library in C++17 / Jacek Galowicz.

Ebook Central College Complete Available online

View online

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Galowicz, Jacek, author.
Language:
English
Subjects (All):
Threads (Computer programs).
C++ (Computer program language).
Physical Description:
1 online resource (523 pages) : illustrations
Edition:
1st edition
Other Title:
C plus plus seventeen Standard Template Library cookbook
Place of Publication:
Birmingham, [England] : Packt Publishing, 2017.
System Details:
text file
Biography/History:
Galowicz Jacek: Jacek Galowicz obtained his master of science in electrical engineering/computer engineering at RWTH Aachen University, Germany. While at university, he enjoyed working as a student assistant in teaching and research, and he participated in several scientific publications. During and after his studies, he worked as a freelancer and implemented applications as well as kernel drivers in C and C++, touching various areas, including 3D graphics programming, databases, network communication, and physics simulation. In recent years, he has been programming performance- and security-sensitive microkernel operating systems for Intel x86 virtualization at Intel and FireEye in Braunschweig, Germany. He has a strong passion for modern C++ implementations of low-level software, and he tries hard to combine high performance with an elegant coding style. Learning purely functional programming and Haskell in recent years triggered his drive to implement generic code with the aid of meta programming.
Summary:
Over 90 recipes that leverage the powerful features of the Standard Library in C++17 About This Book Learn the latest features of C++ and how to write better code by using the Standard Library (STL). Reduce the development time for your applications. Understand the scope and power of STL features to deal with real-world problems. Compose your own algorithms without forfeiting the simplicity and elegance of the STL way. Who This Book Is For This book is for intermediate-to-advanced C++ programmers who want to get the most out of the Standard Template Library of the newest version of C++: C++ 17. What You Will Learn Learn about the new core language features and the problems they were intended to solve Understand the inner workings and requirements of iterators by implementing them Explore algorithms, functional programming style, and lambda expressions Leverage the rich, portable, fast, and well-tested set of well-designed algorithms provided in the STL Work with strings the STL way instead of handcrafting C-style code Understand standard support classes for concurrency and synchronization, and how to put them to work Use the filesystem library addition available with the C++17 STL In Detail C++ has come a long way and is in use in every area of the industry. Fast, efficient, and flexible, it is used to solve many problems. The upcoming version of C++ will see programmers change the way they code. If you want to grasp the practical usefulness of the C++17 STL in order to write smarter, fully portable code, then this book is for you. Beginning with new language features, this book will help you understand the language's mechanics and library features, and offers insight into how they work. Unlike other books, ours takes an implementation-specific, problem-solution approach that will help you quickly overcome hurdles. You will learn the core STL concepts, such as containers, algorithms, utility classes, lambda expressions, iterators, and more, while working on practical real-world recipes. These recipes will help you get the most from the STL and show you how to program in a better way. By the end of the book, you will be up to date with the latest C++17 features and save time and effort while solving tasks elegantly using the STL. Style and approach This recipe-based guide will show you how to make the best use of C++ together with the STL to squeeze more out of the standard language
Contents:
Cover
Copyright
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Table of Contents
Preface
Chapter 1: The New C++17 Features
Introduction
Using structured bindings to unpack bundled return values
How to do it...
How it works...
There's more...
Limiting variable scopes to if and switch statements
Profiting from the new bracket initializer rules
Letting the constructor automatically deduce the resulting template class type
Simplifying compile time decisions with constexpr-if
Enabling header-only libraries with inline variables
How it's done...
Implementing handy helper functions with fold expressions
Match ranges against individual items
Check if multiple insertions into a set are successful
Check if all the parameters are within a certain range
Pushing multiple items into a vector
Chapter 2: STL Containers
Contiguous storage
List storage
Search trees
Hash tables
Container adapters
Using the erase-remove idiom on std::vector
Deleting items from an unsorted std::vector in O(1) time
Accessing std::vector instances the fast or the safe way
Keeping std::vector instances sorted
Inserting items efficiently and conditionally into std::map
There's more.
Knowing the new insertion hint semantics of std::map::insert
Efficiently modifying the keys of std::map items
Using std::unordered_map with custom types
Filtering duplicates from user input and printing them in alphabetical order with std::set
std::istream_iterator
std::inserter
Putting it together
Implementing a simple RPN calculator with std::stack
Stack handling
Distinguishing operands from operations from user input
Selecting and applying the right mathematical operation
Implementing a word frequency counter with std::map
Implement a writing style helper tool for finding very long sentences in text with std::multimap
Implementing a personal to-do list using std::priority_queue
Chapter 3: Iterators
Iterator categories
Input iterator
Forward iterator
Bidirectional iterator
Random access iterator
Contiguous iterator
Output iterator
Mutable iterator
Building your own iterable range
Making your own iterators compatible with STL iterator categories
Using iterator adapters to fill generic data structures
std::back_insert_iterator
std::front_insert_iterator
std::insert_iterator
std::ostream_iterator
Implementing algorithms in terms of iterators
Iterating the other way around using reverse iterator adapters
Terminating iterations over ranges with iterator sentinels
Automatically checking iterator code with checked iterators
Building your own zip iterator adapter
Ranges library
Chapter 4: Lambda Expressions
Defining functions on the run using lambda expressions
Capture list
mutable (optional)
constexpr (optional)
exception attr (optional)
return type (optional)
Adding polymorphy by wrapping lambdas into std::function
Composing functions by concatenation
Creating complex predicates with logical conjunction
Calling multiple functions with the same input
Implementing transform_if using std::accumulate and lambdas
Generating cartesian product pairs of any input at compile time
Chapter 5: STL Algorithm Basics
Copying items from containers to other containers
Sorting containers
Removing specific items from containers
Transforming the contents of containers
Finding items in ordered and unordered vectors
Limiting the values of a vector to a specific numeric range with std::clamp
How it works.
Locating patterns in strings with std::search and choosing the optimal implementation
Sampling large vectors
Generating permutations of input sequences
Implementing a dictionary merging tool
Chapter 6: Advanced Use of STL Algorithms
Implementing a trie class using STL algorithms
Implementing a search input suggestion generator with tries
Implementing the Fourier transform formula with STL numeric algorithms
Calculating the error sum of two vectors
Implementing an ASCII Mandelbrot renderer
Building our own algorithm - split
Composing useful algorithms from standard algorithms - gather
Removing consecutive whitespace between words
Compressing and decompressing strings
Chapter 7: Strings, Stream Classes, and Regular Expressions
Creating, concatenating, and transforming strings
Trimming whitespace from the beginning and end of strings
Getting the comfort of std::string without the cost of constructing std::string objects
Reading values from user input
Counting all words in a file
Formatting your output with I/O stream manipulators.
How to do it...
Initializing complex objects from file input
Filling containers from std::istream iterators
Generic printing with std::ostream iterators
Redirecting output to files for specific code sections
Creating custom string classes by inheriting from std::char_traits
Tokenizing input with the regular expression library
Comfortably pretty printing numbers differently per context on the fly
Catching readable exceptions from std::iostream errors
Chapter 8 : Utility Classes
Converting between different time units using std::ratio
Converting between absolute and relative times with std::chrono
Safely signalizing failure with std::optional
Applying functions on tuples
Quickly composing data structures with std::tuple
operator&lt
&lt
for tuples
The zip function for tuples
Replacing void* with std::any for more type safety
Storing different types with std::variant
Automatically handling resources with std::unique_ptr
Automatically handling shared heap memory with std::shared_ptr
Dealing with weak pointers to shared objects
Simplifying resource handling of legacy APIs with smart pointers.
Notes:
Includes index.
Description based on online resource; title from PDF title page (ebrary, viewed July 25, 2017).
ISBN:
9781787121768
1787121763
OCLC:
994027749

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account