Posts
C++ Basics: Validate Calendar Fields Before Counting Days
Check year_month_day::ok before converting a date into a day-based time point.
November 5, 2026
C++ Basics: Round-Trip a String with Spaces and Quotes
Use std::quoted with string streams to preserve spaces, embedded quotes, and backslashes.
November 5, 2026
C++ Basics: Rotate an Eight-Bit Pattern Without Losing Bits
Use std::rotl and std::rotr to wrap bits around a fixed-width unsigned value.
November 5, 2026
C++ Basics: Pad Each Output Field Explicitly with setw
Separate one-field width settings from persistent fill characters in formatted stream output.
November 5, 2026
C++ Basics: Measure the Bits Needed for an Unsigned Value
Use std::bit_width instead of floating-point logarithms when sizing an unsigned value.
November 5, 2026
C++ Basics: Match Bitset Text to Bit Positions
Read a fixed-size bitset from binary text and distinguish printed order from numeric indexes.
November 5, 2026
C++ Basics: Interpolate a Reading with std::lerp
Use a fractional position to interpolate between two readings and recognize extrapolation.
November 5, 2026
C++ Basics: Find an Integer Midpoint Without Overflow
Use std::midpoint for large integer endpoints and make its rounding direction explicit.
November 5, 2026
C++ Basics: Count Only the Flags in a Selected Mask
Combine a bit mask with std::popcount to count enabled options in one group.
November 5, 2026
C++ Basics: Compare Repeating Periods with gcd and lcm
Find a shared time unit and the next common boundary for two small integer periods.
November 5, 2026