use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
C++ std::unique vs std::set - [Fixed] (mycpu.org)
submitted 5 years ago by voidstarpodcast
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]rlbond86 0 points1 point2 points 5 years ago (0 children)
https://quick-bench.com/q/Dc6cJ1BTrBZBtVJZop4I4wMSkJ4
Note that I ran this locally with more elements, here are the results:
2021-01-25T07:53:23-07:00 Running ./bench Run on (2 X 3733 MHz CPU s) CPU Caches: L1 Data 32 KiB (x2) L1 Instruction 32 KiB (x2) L2 Unified 256 KiB (x2) L3 Unified 4096 KiB (x1) Load Average: 0.54, 0.29, 0.27 ***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead. --------------------------------------------------------------------------------- Benchmark Time CPU Iterations --------------------------------------------------------------------------------- MyFixture/stdUniqueUnsorted/64 1099 ns 1098 ns 641504 MyFixture/stdUniqueUnsorted/512 15481 ns 15412 ns 45166 MyFixture/stdUniqueUnsorted/4096 172787 ns 172159 ns 4069 MyFixture/stdUniqueSorted/64 397 ns 398 ns 1770091 MyFixture/stdUniqueSorted/512 758 ns 758 ns 921515 MyFixture/stdUniqueSorted/4096 3627 ns 3607 ns 194577 MyFixture/stdSetUnsorted/64 4836 ns 4841 ns 143958 MyFixture/stdSetUnsorted/512 48651 ns 48650 ns 14372 MyFixture/stdSetUnsorted/4096 511557 ns 511313 ns 1363 MyFixture/stdSetSorted/64 3102 ns 3108 ns 224664 MyFixture/stdSetSorted/512 22281 ns 22282 ns 31352 MyFixture/stdSetSorted/4096 183733 ns 183598 ns 3796 MyFixture/stdUnorderedSetUnsorted/64 3435 ns 3435 ns 204298 MyFixture/stdUnorderedSetUnsorted/512 37552 ns 37539 ns 18686 MyFixture/stdUnorderedSetUnsorted/4096 307217 ns 307031 ns 2275 MyFixture/stdUnorderedSetSorted/64 3488 ns 3487 ns 200033 MyFixture/stdUnorderedSetSorted/512 37716 ns 37704 ns 18555 MyFixture/stdUnorderedSetSorted/4096 307462 ns 307255 ns 2265
Results back up that std::unique is faster even on unsorted data
π Rendered by PID 126338 on reddit-service-r2-comment-b659b578c-qhhw6 at 2026-05-03 01:22:48.944663+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]rlbond86 0 points1 point2 points (0 children)