
"Eric Niebler" <eric@boost-consulting.com> wrote in message news:41AE786B.50306@boost-consulting.com...
Jonathan Turkanis wrote:
"Eric Niebler" <eric@boost-consulting.com> wrote:
If anyone knows of a foolproof way to distinguish lvalues from rvalues, I'm all ears.
Oddly enough, I was thinking about this last night, and wrote the attached
code.
It may be wildly wrong <snip>
Unfortunately, it is. There is a precedence problem because the expression to which the macro expands is not enclosed in parens. \
Whoops! I can't believe I made that mistake.
In your tests, the ! is only applied to part of the expression, leading to false positives.
I think it leads to true negatives. ;-) The case you're interested in is const std::string h() { return "hello"; } BOOST_STATIC_ASSERT(!BOOST_IS_LVALUE(h())); which now fails, except on GCC 3.4 :( Are you sure GCC is wrong here? Jonathan