Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Starting out a new project? add these simple help macros and functions to make you life easier!
- */
- =========================================================================
- Easy cout for one variable
- =========================================================================
- #define what_is(arg) std::cout << #arg << ": "<< arg << std::endl;
- int x = 1;
- what_is(x); //x: 1
- =========================================================================
- Easy full cout for one variable
- =========================================================================
- #define what_is_full(arg) std::cout << __FILE__ << " " << __LINE__ << ": "<< #arg << "=" << arg << std::endl;
- int y = 1;
- what_is(y); //"FILE LINE: x=1
- =========================================================================
- Easy cout for one or more variables
- =========================================================================
- template<typename... T>
- void what_is_mult(T&&... args)
- {
- ((std::cout << args), ...);
- }
- int x = 1;
- int y = 2;
- what_is_mult("\n", "x: ", x, "\n", "y: ", y); // x: 1
- // y: 2
- =========================================================================
- Debug mode
- =========================================================================
- #define DEBUG true // or false
- #if DEBUG == true //only do this if we are in DEBUG mode
- //Do something if we are in DEBUG mode
- #endif
- =========================================================================
- =========================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement