FRB_MESSI_3MK's blog

By FRB_MESSI_3MK, history, 12 months ago, In English

Hello codeforces!

This is the debugging header i use in C++ wich i got from tourist and modified it a bit

Debug.h

And this is my main code:

main.cpp

The code is not complete but it can show how you define the debugger

How to use:

you type debug(value[1],value[2],...,value[n])
you can send as many values as you want and the debugger will print them

Examples:

	int a = 5;
	bool b = 1;
	char c = 'c';
	double d = 1.52;
	vector<int>v = {1,2,3};
	vector<vector<int>>vv = { {1,2,3},{5,6} };
	map<char, int>mp;
	mp['a'] = 1;
	mp['h'] = 4;
	debug(a, b, c, d);
	debug(v, vv, mp);

Output:
[a, b, c, d, e] = [5, true, 'c', 1.52]

[v, vv, mp] = [{1,2,3}, {{1,2,3},{5,6}}, {{'a',1},{'h',4}}]

Working data types:

  • int
  • char
  • double
  • float
  • long long
  • unsinged
  • string
  • vector
  • set
  • map
  • pair
  • multiset

and any data type you can iterate by for(auto it : name)

Data types that does not work

  • stack
  • queue
  • deque
  • priority_queue

and any data type you can't iterate by for(auto it : name)

How to set it:

  1. Create a header file called "Debug.h"
  2. Copy that file to your includes folder
    if you use visual studio you can open your includes folder by holding ctrl button and hovering over your main include wich is usually bits/stdc++.h > right click on the header file when it opens > show in explorer
  3. Paste the Debug.h file into the folder that just opened

OR

  1. Create a header file called "Debug.h"
  2. Leave the header file in any place
  3. Change the include from #include <Debug.h> to #include "<Header file location>"

Sorry for any typing mistakes it took me very long time to write

  • Vote: I like it
  • +17
  • Vote: I do not like it