A single-header C++17 library for pretty-printing STL containers, user-defined types, and complex data structures.
pprint is a header-only C++ library that provides a `PrettyPrinter` class for formatted, readable output of STL containers, user-defined types, and complex data structures. It solves the problem of verbose, hard-to-read debugging output by automatically printing nested containers, enums, variants, and optionals with indentation and structure.
C++ developers working with modern C++17 (or later) who need to debug complex data structures, log container contents, or generate human-readable output for diagnostics.
Developers choose pprint because it's a lightweight, dependency-free single-header library that integrates seamlessly into existing projects, replacing manual loops with a clean, consistent API for readable output.
Pretty Printer for Modern C++
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Just include pprint.hpp with no external dependencies, making it effortless to add to any C++ project without build system changes.
Automatically prints nested vectors, maps, sets, queues, and more with indented formatting, eliminating manual iteration for debugging as shown in the README examples.
Uses magic_enum to print symbolic enum names on supported compilers like GCC >=9, improving readability over raw integer values when conditions are met.
Works with any std::ostream, allowing output to console, strings, files, or custom streams, as demonstrated with std::stringstream in the README.
Supports custom objects via overloaded << operators or inline tuple printing, enabling readable output for complex data structures like the Mesh example.
Enum name printing requires specific compiler versions (e.g., GCC >=9, Clang >=5), which may not be available in all environments, reducing portability.
Lacks built-in support for log levels, timestamps, or file management, making it unsuitable as a standalone logging solution for production systems.
Formatted output with indentation and line breaks can introduce overhead compared to minimal logging, potentially impacting performance in high-frequency debug scenarios.