I am probably 'on the wood way' as we Germans say. (Proverb for going the wrong way)
C++ defines a standard library and this standard gets updated frequently in C++98, C++11, C+17 (correct me if I am wrong). I would assume that each compiler or OS defines its own implementation of this standard library.
So besides the obvious OS specific parts, what are the differences (if any) between these implementations of the standard library?
Are there 'variants' of the implementation for the same OS? And if so when would I want to bother which implementation is used?
Basically any definition of every container is implementation specific. The Standard only dictates the declaration and the expected behavior, the side effects, and the conditions.
Example from §21.4.2:
basic_string(const basic_string& str, size_type pos, size_type n = npos, const Allocator& a = Allocator());
Requires:
pos <= str.size()
Throws:
out_of_range
ifpos > str.size()
.Effects: Constructs an object of class
basic_string
and determines the effective lengthrlen
of the initial string value as the smaller ofn
andstr.size() - pos
, as indicated in Table 65.
As you can see, the Standard also says what the constructor of std::basic_string
does, it doesn't say how it should be implemented. It also defines the signature that should be used. The actual implementation vary across compiler vendors - gcc
and clang
have different implementations, although they are for the same platform, but the constructor do the same thing.
You don't need to worry about the implementations (well, technically, you do - some implementations don't implement everything, but that's rare), as they all (should) do everything documented in the standard.
Well, the word standard does imply a certain meaning, doesn't it.
The point is: if things are standard, then each implementation needs to reflect that standard.
In other words: don't worry about standards, but about those things that are not exactly specified, like here for example.
Besides, this is a very wide topic. I think you should narrow it down to more specific questions/areas.
Edit - reasons why various groups create their own implementations:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With