Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2006-12-22 15:44:21


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Pavol Droba

> Would it be possible to add BOOST_PP_RESET_COUNTER() macro.
> The effect is to reset BOOST_PP_COUNTER to zero.

The purpose of the counter is to provide a globally unique number--across
includes and across libraries. If actually need a variable, you should use the
slot mechanism instead. It is a little more wordy, but it gives you more
control over what the value actually is.

#define BOOST_PP_VALUE 0
#include BOOST_PP_ASSIGN_SLOT(1)

BOOST_PP_SLOT(1) // 0

#define BOOST_PP_VALUE BOOST_PP_SLOT(1) + 1
#include BOOST_PP_ASSIGN_SLOT(1)

BOOST_PP_SLOT(1) // 1

// etc.

We could add a BOOST_PP_SLOT_INC macro to shorten this.

Regards,
Paul Mensonides


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