Skip to content

Posts

C++ Basics: Find the First of Several Delimiters

Use std::find_first_of to locate the earliest character belonging to a delimiter set, rather than searching for a multi-character substring.

Read more →

November 9, 2026

C++ Basics: Find the End of a Ready Prefix

Use std::partition_point to locate the boundary in a range that already places every matching element before every nonmatching element.

Read more →

November 9, 2026

C++ Basics: Exchange Two Prefixes Without Overrunning Either Range

Use C++20 std::ranges::swap_ranges when two buffers may have different lengths. The bounded overload exchanges only paired entries.

Read more →

November 9, 2026

C++ Basics: Distinguish an Empty Suffix from an Invalid Offset

Use std::string::substr to copy a suffix, while recognizing that an offset equal to size is valid and an offset beyond size is not.

Read more →

November 9, 2026

C++ Basics: Count Matching Records Without Building a Copy

Use std::count_if to report how many records meet a threshold without allocating a filtered collection.

Read more →

November 9, 2026

C++ Basics: Copy Records While Excluding a Sentinel

Use std::remove_copy_if to create a cleaned sequence while preserving the original input for inspection.

Read more →

November 9, 2026

C++ Basics: Compare Sorted Lists by Unmatched Occurrences

Use std::set_symmetric_difference to report occurrences that cannot be paired across two sorted lists.

Read more →

November 9, 2026

C++ Basics: Combine Two Ranges with a Bounded Transform

Use the C++20 ranges overload of transform to combine two inputs and stop when either ends. This is useful for pairwise calculations on separately collected readings.

Read more →

November 9, 2026

C++ Basics: Check a String Search Before Slicing

Check std::string::find against npos before using the result as an offset. A missing separator must take a different path from a separator at position zero.

Read more →

November 9, 2026

C++ Basics: Build a Cyclic View Starting at a Chosen Entry

Use std::rotate_copy to materialize a cyclic ordering without rearranging the source queue.

Read more →

November 9, 2026