Boost logo

Boost Users :

Subject: Re: [Boost-users] PP: 2 to the power x macro
From: Ravi (lists_ravi_at_[hidden])
Date: 2010-02-03 21:10:57


On Tuesday 02 February 2010 21:29:40 Hicham Mouline wrote:
> I can't find this left shift operator in Boost.PP.
> Do you mean << ?
> But then how do I evaluate it in the context of the preprocessor?

Unless I have misunderstood your question (very likely), isn't this what you
need?

#define POWER2(a) (1<<a)
// Example usage in the context of the preprocessor
#if POWER2(3) == 8
#error "Success, correct calculation"
#else
#error "Failure"
#endif

Regards,
Ravi


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