Skip to content

Instantly share code, notes, and snippets.

@FreeBirdLjj
Created March 30, 2023 14:58
Show Gist options
  • Save FreeBirdLjj/176927072693962942906e666747551f to your computer and use it in GitHub Desktop.
Save FreeBirdLjj/176927072693962942906e666747551f to your computer and use it in GitHub Desktop.
A useful macro to simulate a REPL in C++.
#include <iostream>
#define REPL(expr) std::cout << "> " << #expr << std::endl << (expr) << std::endl
int main()
{
int a = 1, b = 2;
REPL(a + b);
// print out:
// > a + b
// 3
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment