David Abrahams <[EMAIL PROTECTED]> writes: > > I'd much prefer: > BOOST_WORKAROUND(__SUNPRO_CC, BOOST_LATEST_VERSION(0x530)) > > Which I think is easily achievable, no? > > # define BOOST_WORKAROUND(symbol, test) (symbol != 0) && (1 % ((symbol test) + >1)) > # ifdef BOOST_DETECT_OUTDATED > # define BOOST_LATEST_VERSION(value) >value?-1:1 > # else > # define BOOST_LATEST_VERSION(value) != 0 > # endif > > int x = 0; > > # if BOOST_WORKAROUND(COMPILER_VERSION, < 20) > int y = 0; > # elif BOOST_WORKAROUND(COMPILER_VERSION, BOOST_LATEST_VERSION(20)) > int z = 0; > # endif > > This seems to work for everything but metrowerks, which says: > > ### mwcc Compiler: > # File: foo.cpp > # ---------------- > # 16: ( 21 != 0) && (1 % (( 21 >20?-1:1) + 1)) > # Error: ^ > # expression syntax error > > > :( > > If anyone can come up with a workaround, I'd be psyched!
This does it: # define BOOST_WORKAROUND(symbol, test) (symbol != 0) && (1 % (( (symbol test) ) + 1)) # ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS # define BOOST_OPEN_PAREN ( # define BOOST_CHECKED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1 # else # define BOOST_CHECKED_AT(value) != 0 # endif Now: # if BOOST_WORKAROUND(BOOST_MSVC, BOOST_CHECKED_AT(1300)) Seems to work as desired. Any objections? I think I'm going to modify boost/detail/workaround.hpp now. -- David Abrahams [EMAIL PROTECTED] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost