Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. C/C++
  3. IceCream-Cpp

IceCream-Cpp

NOASSERTIONC++v1.0.0

A single-header C++ library for expressive and concise print debugging, replacing cout/printf with powerful formatting and lazy evaluation.

GitHubGitHub
749 stars37 forks0 contributors

What is IceCream-Cpp?

Icecream-cpp is a single-header C++ library that simplifies print debugging by replacing verbose `cout` or `printf` statements with concise macros. It automatically prints variable names and values, supports formatting, and can inspect data in range pipelines, making debugging faster and less error-prone. The library is designed for use during development and can be disabled for production builds.

Target Audience

C++ developers (C++11 and later) who frequently use print debugging and want a more expressive, less intrusive way to inspect variables, function flow, and range-based data transformations.

Value Proposition

Developers choose Icecream-cpp because it drastically reduces boilerplate in debug code, provides rich formatting options, and integrates seamlessly with modern C++ features like ranges and third-party libraries. Its header-only nature and configurability make it easy to adopt and tailor to specific debugging needs.

Overview

🍦 Never use cout/printf to debug again

Use Cases

Best For

  • Quickly inspecting variable values during C++ development without writing verbose output statements
  • Debugging complex range or view pipelines in C++20 or Range-v3 by inserting print points lazily
  • Formatting debug output in hex, decimal, or custom layouts for integers, floats, and containers
  • Adding context-aware debug prints that automatically include file, line, and function information
  • Temporarily enabling detailed logging in specific scopes with configurable output destinations
  • Integrating print debugging with third-party libraries like Boost, {fmt}, or Range-v3 without extra setup

Not Ideal For

  • Projects requiring structured, production-grade logging with features like log levels or file output
  • Teams with strict no-macro policies or existing identifier conflicts (e.g., 'IC' used elsewhere)
  • Environments limited to pre-C++11 standards or compilers with poor C++11 support
  • Debugging timing-sensitive code where lazy evaluation in range pipelines could skew performance analysis

Pros & Cons

Pros

Expressive Debugging

IC() macros automatically print variable names and values, replacing verbose cout statements with minimal code, as shown in examples like IC(a, b, sum(a, b)).

Range Pipeline Inspection

IC_V() integrates lazily into C++20 or Range-v3 pipelines to print intermediate data without breaking the flow, supporting views like vws::split.

Flexible Formatting

Format strings (e.g., IC_F('#x', i)) allow control over output for integers, floats, ranges, and tuples, including hex, decimal, and slicing.

Configurable Behavior

Global and scoped IC_CONFIG objects enable customization of output destination, prefixes, string handling, and more, with thread-safe operations.

Cons

Macro Naming Conflicts

The IC macro can clash with other identifiers, requiring workarounds like defining ICECREAM_LONG_NAME, as admitted in the pitfalls section.

Complex Character Encoding

Handling wide and Unicode strings involves multiple transcoding layers (wide_string_transcoder, unicode_transcoder), which can be confusing and require custom implementations for edge cases.

Pre-C++20 Macro Limitations

For standards before C++20, separate nullary macros like IC0() are needed, adding boilerplate and complexity for cross-version compatibility.

Frequently Asked Questions

Quick Stats

Stars749
Forks37
Contributors0
Open Issues0
Last commit4 months ago
CreatedSince 2019

Tags

#formatting#c-plus-plus-11#print-debugging#cpp17#single-header-lib#debug#c-plus-plus#print#development-tools#single-header#debugging-tool#cpp14#debugging#cpp11#cpp#header-only

Built With

N
Nix
C
C++11
C
CMake
C
Conan

Included in

C/C++70.6k
Auto-fetched 1 day ago

Related Projects

googletestgoogletest

GoogleTest - Google Testing and Mocking Framework

Stars38,943
Forks10,849
Last commit2 days ago
Google MockGoogle Mock

GoogleTest - Google Testing and Mocking Framework

Stars38,943
Forks10,849
Last commit2 days ago
Catch2Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)

Stars21,428
Forks3,499
Last commit1 day ago
benchmarkbenchmark

A microbenchmark support library

Stars10,356
Forks1,792
Last commit4 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub