Alternative STL implementations in C++11 and beyond
c++, c++11, stl
Solution
You can't write a fully portable standard C++ library implementation in any version of C++! FIrst of all, some standard C++ library components clearly abstract the system specifics. For example, the file streams abstract the access to file access. Yes, you could use `FILE*` under the hood but I consider the standard C library to be part of the standard C++ library and a portable implementation would need to include that portion as well. Also, certain types are actually depending on the compiler, e.g., because there is language level interaction with them. For example `std::bad_cast` is thrown as a result of a `dynamic_cast<...>()`. Also, some standard C++ library components need to make use of knownledge about the memory layout and that `reinterpret_cast<...>()` does the Right Thing. In other cases, the standard library specifies values which cannot be determined portable, e.g., some of the fields of `std::numeric_limits<T>`.
The overall idea of the standard C++ library is that it covers common needs and implements certain features which can't be implemented portably and efficiently. The type traits you quoted are just some of the examples where compilers need to provide some help. Although I tried to get some agreement on how the type traits are exposed by the compilers, the compiler writers insisted that they need to be free on their choices and that the standard C++ library should just give a common interface to the way the traits are exposed.
Problem
Over time various alternative implementations of the STL* have appeared - such as STLPort. Certain large corporations also use their own internal port of the STL for various purposes. With C++03, it's possible to write a port of the STL using only portable C++ language features, meaning that any conforming compiler should be able to compile it. But with C++11, aren't there certain features which require compiler support? For example, I don't see how `std::is_standard_layout` could be implemented using only C++ language features. I think `std::is_base_of` could be implemented in terms of `std::is_convertible`, using base and derived pointers. But I can't imagine how `std::is_standard_layout` could be implemented. There may be other features as well which haven't occurred to me. So, am I correct here? Is it impossible to write am complete port of the standard library in C++11 using only C++ language features? *I know STL and "C++ standard library" are not strictly interchangeable, but obviously I mean the C++ Standard Libary in this case.