Blog
-
[2026] C++ Set Operations on Sorted Ranges: set_union, intersection & difference
Run set_union, set_intersection, set_difference, set_symmetric_difference, and includes on sorted ranges — complexity, duplicates, and output iterators.
-
[2026] C++ std::optional vs Pointers: Representing No Value Safely
std::optional vs nullptr: optional models absent values with type safety; pointers for non-owning observers, polymorphism, and shared ownership. Stack-f...
-
[2026] C++ std::function vs Function Pointers: Flexibility vs Speed
std::function vs raw function pointers: pointers are faster and smaller; std::function type-erases lambdas with captures and functors. Callback design, ...
-
[2026] C++ decltype | Extract Expression Types
decltype vs auto, decltype(auto), trailing return types, SFINAE with decltype, and the decltype(x) vs decltype((x)) pitfall for templates.
-
[2026] C++ Default Initialization | Uninitialized Locals and Undefined Behavior
Default initialization happens with no initializer. Local scalars may be indeterminate; reading them is undefined behavior. Differs from globals (zero i...
-
[2026] C++ Header Files (.h/.hpp): Declarations, Include Guards, and What Belongs Where
How C++ headers declare APIs while .cpp files define behavior: ODR-safe patterns, include guards, forward declarations, templates, inline functions, and...
-
[2026] C++ `if constexpr` | Compile-Time Branching in Templates (C++17)
Use `if constexpr` to discard untaken branches during instantiation—unlike runtime `if`, avoiding ill-formed code in unused branches for templates.
-
[2026] C++ Initializer-List Constructors | `std::initializer_list` Ctors Explained
Constructors taking std::initializer_list enable `{1,2,3}` initialization. They often win overload resolution over `T(int)` for `{}`—design APIs careful...
-
[2026] C++ RVO and NRVO | Return Value Optimization Complete Guide
RVO vs NRVO: when the compiler elides copies on return, C++17 guaranteed elision for prvalues, NRVO heuristics, and interaction with move semantics.
-
[2026] Google Test (gtest) for C++: From Setup to TEST, Fixtures, and CI
Complete C++ unit testing guide with Google Test: FetchContent and vcpkg setup, TEST and TEST_F, EXPECT vs ASSERT, parameterized tests, death tests, TDD...