Skip to main content

Questions tagged [standard-library]

For questions relating to designing and implementing standard library features

6 questions from the last 365 days
Filter by
Sorted by
Tagged with
8 votes
1 answer
1k views

Why did std::set not have a contains function until C++20?

Another design decision that baffled me. Checking if an element is in a set is the entire purpose of a set! Until C++20 I had to write stuff like ...
qwr's user avatar
  • 481
11 votes
3 answers
4k views

Why did C++ standard library name the containers map and unordered_map instead of map and ordered_map?

This is something that has slightly annoyed me for a while. A map as a mathematical object (function) is by default "unordered", and the same is for maps as a data structure AKA associative ...
qwr's user avatar
  • 481
2 votes
0 answers
110 views

Is there a guide for implementing exceptions in languages with explicit memory management?

I'm looking for a guide for implementing exceptions in a language with explicit memory management like C++. However, the language's type system and exception handling semantics are incompatible with C+...
feldentm's user avatar
  • 2,192
2 votes
1 answer
255 views

Is it practical to use binary trees as a sequential container?

Contiguous arrays do not mix with lazy evaluation. That's why Haskell doesn't have contiguous arrays as a primitive type, and why even GHC has a poor API for them. As such, I sought for a workaround. ...
Dannyu NDos's user avatar
3 votes
3 answers
2k views

Why does C++'s unordered_map::erase fully invalidate iterators, not even supporting advancing?

The documentation on C++'s unordered_map::erase states: Removes specified elements from the container. The order of the remaining elements is preserved. (This ...
Luatic's user avatar
  • 330
12 votes
0 answers
512 views

Where does Go's datetime formatting pattern come from? And why was it chosen?

Go's time formatting strings are uniquely idiosyncratic, and I have not seen any other language use this sort of system: It is based on the exact timestamp for ...
bigyihsuan's user avatar
  • 1,851