|
Boost : |
From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2006-02-16 16:05:35
Jon Willesen wrote:
> I recently attempted to upgrade from boost 1.32.0 to boost 1.33.1 got received
> some compiler errors from boost.assign.
>
> My most common usage of boost::assign looks like this:
>
> vector<string> data = (list_of<string>(), "foo", "bar", "baz");
>
> I like this better than the alternative syntax (elements delimeted by
> parentheses) because I can type it more quickly and it more closely resembles
> array initialization syntax, which makes it more likely that my coworkers, who
> aren't as familiar with boost, will understand what's going on.
ok.
> But it appears my compiler errors were caused by the removal of the comma
> operator in the class the list_of function returns. It appears this was
> intentional since the unit tests were changed, but the current documentation
> for list_of still indicates the comma operator is legal syntax, and
> operator+= still uses the comma syntax, so I'm a little confused.
My memory is weak in this respect, but I think I might have viewed the
syntax as redundant.
If you like the comma, you might write
data += "foo", "bar", "baz";
but that is not initialization.
I don't mind adding the operator again, it should be trivially defined,
but I wonder if we removed it because it could actually create problems
in some situations.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk