Alternative to C++ macro in D

Vinod K Chandran kcvinu82 at gmail.com
Sun Nov 3 16:55:36 UTC 2019


Hi all,
I can do this in C++.
#include <iostream>
using namespace std ;

#define end };
#define log(x)  cout << x << endl
#define wait std::cin.get()


int main() {
     log("Trying to avoid the visual clutter aused by closing 
curly braces") ;
     string myStr = "Now, code looks more elegant" ;
     log(myStr) ;
     wait ;
end
How can i do this in D ? Especially the " #define end }; ". I've 
tried " alias end = } " but didn't worked.
Edit : How can add syntax highlighting and coloring in code 
posted on this comment ?


More information about the Digitalmars-d-learn mailing list