Boost logo

Boost Users :

From: Johan 't Hart (jopie64_at_[hidden])
Date: 2007-06-16 19:11:45


Hi,

I don't know if boost has a solution for my problem, or there is just
something simple I miss...
I've been struggling with some preprocessor things. I'm trying to use it for
versioning. Here is the problem:

I've got these defines:

#define VERSION_MAJOR 5
#define VERSION_MINOR 4
#define VERSION_BUILD 3
#define VERSION_SUBBUILD 2

Sometimes I just need a string like: "5.4.3.2". I do it like this:

#define STRINGER_(s) #s
#define STRINGER(s) STRINGER_(s)
#define VERSION_STRING_1 \
    STRINGER(VERSION_MAJOR) "." \
    STRINGER(VERSION_MINOR) "." \
    STRINGER(VERSION_BUILD) "." \
    STRINGER(VERSION_SUBBUILD)

So VERSION_STRING_1 is "5.4.3.2"
Now I need a string like: "5.4.3b". (Note the 'b'. When VERSION_SUBBUILD ==
3, I want it to be a 'c' etc)
How do I do this in a preprocessor command???? The char is simple, its
(VERSION_SUBBUILD+'a'-1). How do I add that to a string?? It just looks so
simple, I can't stand I'm not finding a solution!

I'm hoping someone could help me!

Regards
Johan


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