• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. _module-pw_minimal_cpp_stdlib:
2
3=====================
4pw_minimal_cpp_stdlib
5=====================
6The ``pw_minimal_cpp_stdlib`` module provides an extremely limited
7implementation of the C++ Standard Library. This module falls far, far short of
8providing a complete C++ Standard Library and should only be used for testing
9and development when compiling with C++17 or newer without a C++ Standard
10Library. Production code should use a real C++ Standard Library implementation,
11such as `libc++ <https://libcxx.llvm.org/>`_ or
12`libstdc++ <https://gcc.gnu.org/onlinedocs/libstdc++/>`_.
13
14.. warning::
15
16  ``pw_minimal_cpp_stdlib`` was created for a very specific purpose. It is NOT a
17  general purpose C++ Standard Library implementation and should not be used as
18  one. Many features are missing, some features non-functioning stubs, and some
19  features may not match the C++ standard.
20
21-----------
22Code layout
23-----------
24The C++ Standard Library headers (e.g. ``<cstdint>`` and ``<type_traits>``) are
25defined in ``public/``. These files are symlinks to their implementations in
26``public/internal/``.
27
28.. tip::
29
30  You can automatically recreate the symlinks in ``public/`` by executing the
31  following Bash code from ``pw_minimal_cpp_stdlib/public/``.
32
33  .. code-block:: bash
34
35    for f in $(ls internal/); do ln -s internal/$f ${f%.h}; done
36
37The top-level ``build_with_minimal_cpp_stdlib`` GN group builds a few supported
38modules with ``pw_minimal_cpp_stdlib`` swapped in for the C++ library at the
39toolchain level. Notably, ``pw_minimal_cpp_stdlib`` does not support
40``pw_unit_test``, so this group does not run any tests.
41
42------------
43Requirements
44------------
45- C++17
46- gcc or clang
47- The C Standard Library
48