Questions tagged [standard-library]
For questions relating to designing and implementing standard library features
31 questions
-4
votes
3
answers
211
views
Did std::forward_list really need *_after member functions?
Did C++'s std::forward_list really need insert_after, emplace_after, ...
0
votes
1
answer
233
views
Why does C++ let some standard class templates lack definitions when not specialized, rather than to explicitly let them be unusable by default?
In the standard C++ library, some class templates lack definition, but are defined when their template is specialized. The most notable such class template is ...
4
votes
0
answers
203
views
Prior Art on implementing memory arenas or thread- or work-package-local allocators in systems programming languages
Local allocators can be beneficial in situations where tracking memory usage or releasing all allocated memory without running destructors at the end of an activity is possible. From that perspective, ...
10
votes
5
answers
1k
views
What are the considerations when modifying cases in a text?
By "cases" I mean uppercase, lowercase, and titlecase.
It seems many languages assumes that there is one-to-one correspondence of uppercase letters and lowercase letters, if the script that ...
-1
votes
2
answers
562
views
If in computer science, compare-and-swap is known as "compare-and-swap," why are the C/C++ functions named atomic_compare_exchange_*?
In computer science, compare-and-swap is known as, well, "compare-and-swap" and often abbreviated as "CAS."
Why are the functions in the standard C library and C++ library named <...
3
votes
1
answer
263
views
Is there any particular reason to only implement 2 and 3 input hypot?
I've checked the information on cppreference.com and found that there are only 2 and 3 input hypot function. I am wondering why not implement the variadic version ...
9
votes
1
answer
2k
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 ...
17
votes
3
answers
5k
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 ...
3
votes
0
answers
145
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+...
2
votes
1
answer
282
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.
...
3
votes
3
answers
3k
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 ...
13
votes
0
answers
900
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 ...
12
votes
9
answers
6k
views
Should bytes be signed?
I’m trying to decide whether my language should provide signed or unsigned bytes, but I’m struggling to find a good reason to choose either side.
Popular languages vary in their decision. For example, ...
14
votes
12
answers
7k
views
Can sine converge to zero at infinity?
In common languages, sine produces an error, NaN, or exception when evaluated at infinity. For example, in Python:
...
5
votes
3
answers
418
views
Reading Floating Point, perhaps without libc/msvcrt
Given a new language, how best should we convert decimal to binary floating point? And please don't just say "use strtod(3)": The venerable C function supports a baroque variety of weird ...