Boost logo

Boost :

From: Christophe Prud'homme (prudhomm_at_[hidden])
Date: 2005-10-20 13:48:25


Dear Boosters,

I am trying to keep some backward compatibility (for some while) for the boost
libraries we use in our codes (ublas for example), and I find that the
addition below to boost/version.hpp helps a lot with readability in the code
instead of using

// BOOST_VERSION % 100 is the sub-minor version
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version

-------------------
define BOOST_VERSION_MAJOR 1
#define BOOST_VERSION_MINOR 33
#define BOOST_VERSION_SUBMINOR 1

#define BOOST_MAKE_VERSION( a,b,c ) ((a)*100000+(b)*100+(c))

#define BOOST_VERSION \
BOOST_MAKE_VERSION(BOOST_VERSION_MAJOR,BOOST_VERSION_MINOR,BOOST_VERSION_SUBMINOR)

#define BOOST_IS_VERSION(a,b,c) ( BOOST_VERSION >= BOOST_MAKE_VERSION(a,b,c) )
----------------------------

In order to test the current version of boost:
#if BOOST_IS_VERSION(1,33,0)
  ... write the code according to the API >= 1.33.0
#else
  ... write the code according to the API < 1.33.0
#endif

would that be of interest ?

Best regards
C.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk