Boost logo

Boost Users :

Subject: [Boost-users] Handling mulitiple boost versions
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2010-12-16 06:28:10


As I'm sure is common I write code that builds under several versions of
Boost
which often results in code like...

#if (BOOST_VERSION < 103400)
do this
#else
do that
#endif

This is specifically true for changes to Boost.Filesystem, but also in other
places.
Usually the difference being addressed is obvious, but not always, and in
any
case direct use of "103400" seems to be like a magic number to me.

So, I'd like to do something like this in a global header (in one place for
many versions
and capabilities)

#if (BOOST_VERSION < 103400)
#define BOOST_PRE_FILESYSTEM_RATIONALISATION
#endif

and then say

#ifdef BOOST_PRE_FILESYSTEM_RATIONALISATION
do this
#else
do that
#endif

Is this unwise for any reason I'm not seeing, and are the tokens I'm
defining already
defined somewhere, so I can use those instead?

Thx

- Rob.



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