The Kernel Template Library is a curated subset of the C++ standard library API using the
ktl namespace rather than the
std namespace. When a specific interface is deemed useful, safe, and appropriate for use in the kernel, it can be added here. No
std APIs are ever used directly in the kernel, only
The API is a strict subset of the standard C++ library API aside from the namespace. The header file names are mostly directly mapped as well:
<foo> -> <ktl/foo.h>
There are some exceptions. For example, and are very broad collections of APIs and the ktl subset is more focussed. So instead of <ktl/memory.h> and <ktl/utility.h> there are specific headers for the standard APIs from and that are included, such as <ktl/move.h> for
std::move in ) and <ktl/unique_ptr.h> for
std::unique_ptr in ).
The implementation here simply leverages the libc++ implementation and defines
using aliases in the
ktl namespace. It's expected that ktl will only ever provide “header only” APIs.