
On 09/16/2010 03:55 PM, Eric Niebler wrote:
I am asking because in Proto's documentation terminals are always instantiated with curly braces, e.g.:
typedef proto::terminal<int>::type int_; int_ i = {42}, j = {24};
Correct. If the value type of the terminal is POD, then the terminal can be statically initialized (curly-braced initialization syntax). That's important for terminals like, e.g., bind placeholders that live at namespace scope. It looks like you're going to try to declare a table at namespace scope, so this is something you'll need to think about. Try to make the table::id struct POD. Then you can initialize table at namespace scope like this:
_table const table = {{{}}};
That way, you get static initialization and avoid any order-of-initialization bugs.
OK, got it! Thanks for the explanation :-) Regards, Roland