Boost logo

Boost :

Subject: [boost] [preprocessor] half-open or closed ranges?
From: Eric Niebler (eric_at_[hidden])
Date: 2008-11-26 13:07:34


I've noticed an inconsistency with how the preprocessor library handles
integer ranges. Consider this:

#define M0(Z,N,DATA) N
BOOST_PP_REPEAT_FROM_TO(1,3,M0,~)

This treats the range 1,3 as half-open. It generates the sequence "1 2".
But consider this:

#define BOOST_PP_LOCAL_MACRO(N) N
#define BOOST_PP_LOCAL_LIMITS (1,3)
#include BOOST_PP_LOCAL_ITERATE()

This treats the range 1,3 as closed. It generates the sequence "1 2 3".

Why the difference?

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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