https://github.com/dima74/cpp-useful-functions-for-debug-print
Few easy-to-use debug print functions with nice colored output
https://github.com/dima74/cpp-useful-functions-for-debug-print
debugging
Last synced: 5 months ago
JSON representation
Few easy-to-use debug print functions with nice colored output
- Host: GitHub
- URL: https://github.com/dima74/cpp-useful-functions-for-debug-print
- Owner: dima74
- Created: 2018-02-08T08:41:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-17T11:15:52.000Z (over 3 years ago)
- Last Synced: 2025-04-02T13:41:11.991Z (over 1 year ago)
- Topics: debugging
- Language: C++
- Homepage:
- Size: 13.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Useful functions for debug print
> Generally for use in competitive programming
[](https://travis-ci.com/dima74/cpp-useful-functions-for-debug-print)
# Usage
Include `debug.h`:
#include "debug.h"
And just call `dbg` function with variables which you want to print:
dbg(var1, var2, ...);
And you will get nice colored output! (See gallery and examples sections below)
## Supported types:
* primitives (int, char and so on)
* strings
* vectors
* pairs
* sets
* maps
* all nested combinations of above types are supported too!
# Examples
1. Simple
```
int foo = 1;
int bar = 2;
string str = "abc";
char ch = '#';
dbg(foo, bar, str, ch);
```
2. Vector
```
vector simpleVector = {1, 2, 3};
dbg(simpleVector);
```
3. Map
```
map simpleMap = {{1, 10},
{2, 20}};
dbg(simpleMap);
```
4. Pair
```
pair simplePair = {1, 2};
dbg(simplePair);
```
5. Inner vector
```
vector> innerVector = {{1, 2, 3},
{4, 5, 6}};
dbg(innerVector);
```
# Gallery
[![][1]][1]
[1]: screenshot.png