I am trying to make a C++ compiled model for simple SQL commands. For example this could be a part of my main function which i must be able to handle :
CREATE_TABLE(books) [ // create("books");ovr[
COLUMN(c1) TYPE(string), // "title string",
COLUMN(c2) TYPE(string), // "author string",
COLUMN(num1) TYPE(int) // "price int"
];
So in order to do that i had to overload the “[]” and “,” operators. After doing so, I figured out that the “,” overloader is executed before the “[]” one. Whereas my guess would be that “[]” should be executed first. Is there any particular reason why this happens? Or is it simply because the “[]” is executed when “]” is found?
Your expression would be compiled to something like the following, which might explain the evaluation order:
or
depending on how your
operator,()is defined (and maybe how theCOLUMNandTYPEmacros are defined).