pw_minimal_cpp_stdlib#
Pigweed AI summary: The pw_minimal_cpp_stdlib module provides a limited implementation of the C++ Standard Library, intended only for testing and development purposes when compiling with C++17 or newer without a C++ Standard Library. It is not a general-purpose C++ Standard Library implementation and should not be used as one, as many features are missing or non-functioning stubs, and some features may not match the C++ standard. The C++ Standard Library headers are defined in public/ and are symlinks to
The pw_minimal_cpp_stdlib
module provides an extremely limited
implementation of the C++ Standard Library. This module falls far, far short of
providing a complete C++ Standard Library and should only be used for testing
and development when compiling with C++17 or newer without a C++ Standard
Library. Production code should use a real C++ Standard Library implementation,
such as libc++ or
libstdc++.
Warning
pw_minimal_cpp_stdlib
was created for a very specific purpose. It is NOT a
general purpose C++ Standard Library implementation and should not be used as
one. Many features are missing, some features non-functioning stubs, and some
features may not match the C++ standard.
Code layout#
Pigweed AI summary: The C++ Standard Library headers are defined in public/ and are symlinks to their implementations in public/internal/. The symlinks can be recreated automatically by executing a Bash code. The top-level build_with_minimal_cpp_stdlib GN group builds a few supported modules with pw_minimal_cpp_stdlib swapped in for the C++ library at the toolchain level, but it does not support pw_unit_test, so no tests are run.
The C++ Standard Library headers (e.g. <cstdint>
and <type_traits>
) are
defined in public/
. These files are symlinks to their implementations in
public/internal/
.
Tip
You can automatically recreate the symlinks in public/
by executing the
following Bash code from pw_minimal_cpp_stdlib/public/
.
for f in $(ls internal/); do ln -s internal/$f ${f%.h}; done
The top-level build_with_minimal_cpp_stdlib
GN group builds a few supported
modules with pw_minimal_cpp_stdlib
swapped in for the C++ library at the
toolchain level. Notably, pw_minimal_cpp_stdlib
does not support
pw_unit_test
, so this group does not run any tests.
Requirements#
Pigweed AI summary: This paragraph outlines the requirements for a project, which include using C++17, either gcc or clang as the compiler, and the C Standard Library.
C++17
gcc or clang
The C Standard Library