memesearch
Array Turns Into Set

Array Turns Into Set

Download Find similar pictures
Text on the meme
#include <array> #include <set> #include <iostream> int main() { std::array<int, 5> a{ 0, 1, 2, 3, 4 }; auto s0 = std::set{a.begin(), a.end()}; auto s1 = std::set{a.begin(), a.end()}; std::cout << s0.size() << ": "; for (const auto& e: s0) std::cout << e << " "; std::cout << std::endl << s1.size() << ": "; for (const auto& e: s1) std::cout << e << " "; } ASM generation compiler returned: 0 Execution build compiler returned: 0 Program returned: 0 2: 0x7fff15fbe6d0 0x7fff15fbe6e4 5: 0 1 2 3 4
What it means

A C++ code screenshot shows two apparently identical constructions of std::set from the same array. The first line unexpectedly produces a set of two pointer-like values, while the second correctly produces five integers, joking about subtle C++ initializer-list and iterator behavior. It is used as a reaction to confusing, surprising, or repeatedly frustrating programming bugs.

Objects
Tags
Source
Type
image
Size
660×800 · 82.8 KiB
Mood
confused, frustrated
Language
en
Added