Practical C++ STL Programming: Real-World Applications with C++20 and C++23

Practical C++ STL Programming: Real-World Applications with C++20 and C++23

Practical C++ STL Programming: Real-World Applications with C++20 and C++23
Автор: Kusswurm Daniel
Дата выхода: 2024
Издательство: Apress Media, LLC.
Количество страниц: 898
Размер файла: 2.6 MB
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы

Table of Contents....4

About the Author....11

About the Technical Reviewer....12

Acknowledgments....13

Introduction....14

Prologue....18

Chapter 1: C++ Review....24

Templates....24

Source Code Overview....34

Containers and Iterators....35

Strings....40

User-Defined Classes....46

User-Defined Template Classes....57

Lambda Expressions....64

Three-Way Comparison Operator....71

Exceptions....81

Summary....84

Chapter 2: Formatted I/O....86

Formatted Output Using std::printf()....86

Formatted Output Using Streams....91

Formatted Output Using std::format()....103

Formatted Output Using std::print()....116

Formatted File I/O Using Streams....120

Summary....126

Chapter 3: Sequence Containers – Part 1....127

Overview of Sequence Containers....127

Using std::array....128

Using std::vector....138

More Algorithms Using std::array and std::vector....150

Summary....156

Chapter 4: Sequence Containers – Part 2....158

Using std::deque....158

Using std::list....169

Using std::forward_list....179

Understanding Iterators....186

Summary....192

Chapter 5: General Utilities Library....194

Heterogeneous Containers....194

Using std::pair....195

Using std::tuple....201

Utility Classes....211

Using std::variant....211

Using std::optional....221

Using std::any....240

Using std::expected....244

Summary....252

Chapter 6: Smart Pointers....253

Smart Pointer Primer....253

Using std::unique_ptr....255

Using std::shared_ptr....268

Using std::weak_ptr....274

Summary....278

Chapter 7: Associative Containers....279

Using std::set....279

Using std::multiset....291

Using std::map....296

Using std::multimap....312

Summary....320

Chapter 8: Unordered Associative Containers....321

Unordered Associative Container Primer....321

Hash Functions and Concepts....322

Using std::unordered_set....323

Using std::unordered_multiset....346

Using std::unordered_map....353

Using std::unordered_multimap....365

Summary....372

Chapter 9: Container Adaptors....374

Container Adaptor Primer....374

Using std::stack....376

Using std::queue....389

Using std::priority_queue....394

Flat Container Adaptors....406

Summary....407

Chapter 10: Algorithms – Part 1....409

Algorithm Primer....409

Counting Algorithms....411

Minimum and Maximum Algorithms....426

Copy Algorithms....432

Move Algorithms....438

Reversal Algorithms....443

Replacement Algorithms....446

Removal Algorithms....454

Fill Algorithms....461

Summary....465

Chapter 11: Algorithms – Part 2....467

For_Each Algorithms....467

Transformation Algorithms....472

Generation Algorithms....477

Find Algorithms....482

Contains Algorithms....501

More Find Algorithms....509

Search Algorithms....512

Accumulate and Fold Algorithms....521

Summary....529

Chapter 12: Algorithms – Part 3....531

Sorting Algorithms....531

Binary Search Algorithms....541

Partition Algorithms....549

Heap Algorithms....553

Summary....560

Chapter 13: Algorithms – Part 4....562

Merge Algorithms....562

Shuffle and Sample Algorithms....570

Rotate and Shift Algorithms....574

Set Algorithms....581

Permutation Algorithms....585

Summary....589

Chapter 14: Ranges – Part 1....591

Range Views and Adaptors Primer....591

Range Views and Adaptors....593

Range Adaptors and Pipelines....600

Range Projections....606

More Range Adaptors....614

Range Views and Adaptors Minutiae....620

Summary....625

Chapter 15: Ranges – Part 2....626

Tuple Views....626

More Tuple Views....631

Join, Split, and Cartesian Product Views....641

Slide, Stride, and Chunk Views....648

Range Factories....657

Summary....662

Chapter 16: Time Library....664

Ratios....664

Durations....671

Clocks and Timepoints....680

More Clocks and Timepoints....690

Software Benchmarking....695

Summary....702

Chapter 17: File Systems....703

File System Path Classes....703

File System Directory Iterator Classes....713

File System Helper Functions....723

File System Copy Functions....732

Summary....739

Chapter 18: Numerical Processing – Part 1....741

Mathematical Constants....741

Complex Numbers....748

Random Number Generation....757

Using Generators and Distributions....761

Dice Games....769

Vector of Random Numbers....778

Summary....781

Chapter 19: Numerical Processing – Part 2....783

Class std::valarray....783

Arithmetic Functions....784

Statistical Calculations....791

Class std::slice....799

Basic Operations....799

Covariance Matrix....808

Inner Products and Reductions....813

Summary....822

Chapter 20: Concurrency – Part 1....824

Concurrency Primer....824

Execution Policies....826

Mutexes....834

Threads....838

Atomic Operations....846

Multithreaded Algorithms....854

Summary....864

Chapter 21: Concurrency – Part 2....865

Semaphores....865

Latches....873

Condition Variables....878

Futures....885

Summary....898

Learn how to use the classes, algorithms, and other programming constructs of C++ STL. This comprehensive and practical guide covers a broad range of STL programming topics and highlights numerous programming constructs from the C++20 and C++23 standards.

Mastering use of STL can be daunting for both new and experienced C++ programmers. It doesn’t help that the ISO C++ specification documents are meticulous and verbose. This book is organized to help you quickly understand C++ STL programming, focusing on the real-world aspects of its usage. Rather than spend time providing extensive explanations of the inner workings of STL, author Daniel Kusswurm judiciously explores these intricacies only when they advance the reader’s understanding of a particular topic.

This book is accompanied by over 100 source code examples, designed to accelerate learning by emphasizing practical use cases. It coincides with the C++20 and C++23 standards and works with any OS platform that supports these standards including Windows (Visual C++), Linux (GNU C++) and macOS (clang). After reading Practical C++ STL Programming, you’ll be able to exploit the computational capabilities of STL to implement a wide variety of software algorithms and solve unique programming challenges.

What You Will Learn

  • Explore STL capabilities, including how to generate formatted output, utilize sequence containers, apply utility classes, exploit smart pointers, manipulate associative containers, and exercise container adaptors.
  • Apply algorithms and iterators to perform a wide variety of container operations including sorts, searches, insertions, removals, and erasures.
  • Utilize ranges and range iterators, adaptors, views, compositions, projections, and factories.
  • Perform file and directory operations using STL’s file system classes.
  • Execute chronological calculations and formatting using the time classes.
  • Employ STL’s random number generation and distribution classes.
  • Implement numerical processing algorithms using STL’s std::valarray and std:complex classes.
  • Accelerate program performance using STL’s concurrency classes and algorithm execution policies.

Who This Book Is For

Software developers and programmers who understand the basic syntax and semantics of C++ and want/need to learn how to use STL’s classes and algorithms, or programmers who have experience using STL as specified by the C++11/14/17 standards and are interested in learning how to use the new STL classes and algorithms of C++20/23. Computer science/engineering students or hobbyists who want to learn about or better understand the capabilities of STL.


Похожее:

Список отзывов:

Нет отзывов к книге.