Boost logo

Boost :

Subject: [boost] [predef] Suggestion for Boost itself to start using this.
From: Fletcher, John P (j.p.fletcher_at_[hidden])
Date: 2014-01-25 12:41:24

I have started to use the Boost predef library. I think it will be a good idea for this to be used within Boost. This is actually contained in the Future Work section of the Boost predef manual.

* And obviously there's lots of work to do in reformulating the existing Boost libraries to use the Predef library once it's accepted.

I have been attempting to make use of it and one of the problems is that BOOST_VERSION itself is not consistent with it. It would I think break a lot of existing code to change BOOST_VERSION. Instead I suggest having another define a longside it which is consistent with Boost predef.

I wnt to make the following suggestions to go into the definition of the version.

First check that the version of Boost is recent enough. 1.55.0 is the first to have Boost predef.

#include <boost/version.hpp>
#if BOOST_VERSION >= 105500
#include <boost/predef.h>
#include <iostream>
#include <string>
#include <sstream>

Then if that is true then construct a new defintion:

// The following translates BOOST_VERSION to a BOOST_VERSION_NUMBER!!
// BOOST_VERSION % 100 is the patch level
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
   #define BVN BOOST_VERSION_NUMBER(BV / 100000,BV / 100 % 1000,BV %100)
   #undef BVN
   #undef BV

Other libraries can also construct new version codes.

John Fletcher

Boost list run by bdawes at, gregod at, cpdaniel at, john at