Tag: union
3 posts
-
std::set_union, set_intersection and set_difference on Sorted Ranges: Duplicates, Comparators and Silent Wrong Output
How the STL set algorithms merge two sorted ranges in one pass, how they treat duplicates, and why unsorted input or a mismatched comparator fails silently.
-
C++17 std::variant: Access, std::visit, valueless_by_exception and Conversion Traps
Using std::variant safely: get vs get_if, std::visit with overloaded{}, why a double can silently hit your int handler, valueless variants and size cost.
-
C++ std::variant vs union: Type Safety, Overhead and When to Use Each
std::variant vs union: how variant tracks the active type and dispatches with std::visit, what a raw union leaves to you, and migrating legacy unions.