Questions tagged [standard-library]
The standard-library tag has no summary.
24 questions
2 votes
1 answer
226 views
Why is std::dynamic_extent not zero in c++?
For context, I'm trying to make a span type that has a size type parameter, which mimics much of the std::span api. std::dynamic_extent is not zero in C++, instead being defined as -1ull or std::...
-1 votes
2 answers
582 views
what algorithm does the malloc function in the c language standard library use? And why it so fast?
Based on the data structure of the AVL tree, I implemented a memory manager that does the best matching according to the size. I originally thought that the speed would be fast and the length of the ...
-3 votes
2 answers
2k views
What is the benefit of Java collection streams over C# or Scala collections?
Java collection streams were introduced in Java 8, which came out in March of 2014. By that time, we already had well-established mechanisms for manipulating collections in several other languages, ...
0 votes
1 answer
251 views
Common methods for swapping out a library
I am trying to come up with a solution to replace joda-time with java 8 time in our product. The code-base encompasses many projects of which some import joda-time directly and some transitively. To ...
2 votes
1 answer
4k views
How to optimize reusing a large std::unordered_map as a temporary in a frequently called function?
Simplified question with a working example: I want to reuse a std::unordered_map (let's call it umap) multiple times, similar to the following dummy code (which does not do anything meaningful). How ...
3 votes
2 answers
341 views
Why does Java's getSystemResourceAsStream silently consume IOExceptions?
While trying to debug a weird issue where I knew an exception should have been thrown but was not, I found the following in the Java standard library's java.lang.ClassLoader class: /** * Open for ...
3 votes
4 answers
873 views
Equivalent of C library functions
In C, almost everything requires a function. What nags me is that I don't know exactly what's going on. If there was no msvcrt.dll file, my C programs would all break because that's where all the ...
8 votes
3 answers
10k views
Why would an interface override methods of the interface(s) it extends in Java 7?
I was looking at Map and SortedMap documentation from Java 7 and I have realized that SortedMap, which extends Map overrides entrySet(), keySet() and values(). AFAIK, interfaces cannot implement a ...