FirstCity
Welcome to First City University College Library iPortal | library@firstcity.edu.my | +603-7735 2088 (Ext. 519)

Data Structures and Algorithms with the C++ STL: A Guide for Modern C++ Practitioners.

FARRIER, John

Data Structures and Algorithms with the C++ STL: A Guide for Modern C++ Practitioners. - [S.l.] : PACKT PUBLISHING, 2024 - xxi, 429 pages : illustrations ; 23 cm.

Intro -- Title page -- Copyright and credits -- Dedication -- Contributors -- Table of Contents -- Preface -- Part 1: Mastering std::vector -- Chapter 1: The Basics of std::vector -- Technical requirements -- The significance of std::vector -- A basic comparison of C-style arrays and std::vector -- Comparison of C-style arrays and std::vector for memory management -- Declaring and initializing std::vector -- Declaring a vector -- Initializing a vector -- Accessing elements -- Random access -- Accessing the first and last elements -- Vector size -- Adding and removing elements Adding elements -- Removing elements -- Capacity -- Prefer using empty when possible -- Clearing all elements -- Summary -- Chapter 2: Mastering Iterators with std::vector -- Technical requirements -- Types of iterators in the STL -- Input iterators -- Output iterators -- Forward iterators -- Reverse iterators -- Bidirectional iterators -- Random access iterators -- Basic iteration techniques with std::vector -- Iterating over std::vector -- Basic iteration using iterators -- Using constant iterators -- Benefits of iteration -- Using std::begin and std::end Understanding iterator requirements -- Range-based for loops -- Overview of range-based for loops -- When to use range-based for loops -- Modifying elements during iteration -- Creating a custom iterator -- The appeal of custom iterators -- Core requirements -- Iterator categories and their specialties -- A custom iterator example -- Custom iterator challenges and use cases -- Illustrative use cases of custom iterators -- Summary -- Chapter 3: Mastering Memory and Allocators with std::vector -- Technical requirements -- Understanding capacity versus size -- Revisiting the basics What exactly is capacity? -- Why this distinction matters -- Looking under the hood -- Resizing and reserving memory -- The power of resize -- Enter reserve -- Optimizing with shrink_to_fit -- Real-world relevance -- Custom allocator basics -- The role and responsibility of an allocator -- Under the hood -- the allocator interface -- Trade-offs and the need for custom allocators -- Choosing std::allocator over new, delete, and managed pointers -- Creating a custom allocator -- Custom allocators -- the heart of memory flexibility -- Understanding the motivation behind custom allocators Memory pools -- a popular custom allocator strategy -- Unlocking the potential of custom allocators -- Allocators and container performance -- Why allocators matter in performance -- The performance characteristics of std::allocator -- When to consider alternative allocators -- Profiling -- the key to making informed decisions -- Summary -- Chapter 4: Mastering Algorithms with std::vector -- Technical requirements -- Sorting a vector -- Getting started with std::sort -- The engine under the hood -- introsort -- Efficiency unparalleled -- O(n log n) -- Sorting in descending order

Available to OhioLINK libraries

Explore the C++ STL with practical guidance on vectors, algorithms, and custom types for intermediate developers, enriched by real-world examples. Key Features Master the std::vector and understand why it should be your default container of choice Understand each STL algorithm and its practical applications Gain insights into advanced topics such as exception guarantees and thread safety Purchase of the print or Kindle book includes a free PDF eBook Book Description While the Standard Template Library (STL) offers a rich set of tools for data structures and algorithms, navigating its intricacies can be daunting for intermediate C++ developers without expert guidance. This book offers a thorough exploration of the STL's components, covering fundamental data structures, advanced algorithms, and concurrency features. Starting with an in-depth analysis of the std::vector, this book highlights its pivotal role in the STL, progressing toward building your proficiency in utilizing vectors, managing memory, and leveraging iterators. The book then advances to STL's data structures, including sequence containers, associative containers, and unordered containers, simplifying the concepts of container adaptors and views to enhance your knowledge of modern STL programming. Shifting the focus to STL algorithms, you'll get to grips with sorting, searching, and transformations and develop the skills to implement and modify algorithms with best practices. Advanced sections cover extending the STL with custom types and algorithms, as well as concurrency features, exception safety, and parallel algorithms. By the end of this book, you'll have transformed into a proficient STL practitioner ready to tackle real-world challenges and build efficient and scalable C++ applications. What you will learn Streamline data handling using the std::vector Master advanced usage of STL iterators Optimize memory in STL containers Implement custom STL allocators Apply sorting and searching with STL algorithms Craft STL-compatible custom types Manage concurrency and ensure thread safety in STL Harness the power of parallel algorithms in STL Who this book is for This book is for intermediate-level C++ developers looking to enhance their software development skills. Familiarity with basic C++ syntax and object-oriented programming (OOP) as well as some exposure to data structures and algorithms is assumed. Tailored to software engineers, computer science students, and hobbyist programmers, this book delves into C++ STL for practical application, performance enhancement, and efficient coding practices

9781835468555

9781835468555 O'Reilly Media


C++ (Computer program language)
Data structures (Computer science)
Object-oriented programming (Computer science)


Electronic books

QA76.73.C153

005.7/3 FAR 2024