|
Boost : |
From: Jon Willesen (jon_boost_at_[hidden])
Date: 2006-02-16 13:58:05
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.
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.
I remember there was some discussion on this list earlier about the comma
operator and whether it is ever ok to overload it, but I couldn't find
anything about actually removing it from any aspect of boost.assign in the
mailing list, the documentation, or the version history. Maybe I haven't
looked deeply enough yet? Was the comma operator intentionally removed from
list_of? If so, I would like to understand why so I can be properly
dissuaded from reintroducing it for my own use.
Thanks,
-- Jon Willesen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk