Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Default-constructing a proto::terminal
From: Roland Bock (rbock_at_[hidden])
Date: 2010-09-16 11:16:23


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net