Boost logo

Boost Users :

Subject: Re: [Boost-users] [preprocessor]
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2009-12-07 04:30:40


2009/12/6 Christian Henning <chhenning_at_[hidden]>

> Hi there,
>
> let's assume I have a structure which takes 5 ints as template parameters.
>
> template< int NumChannel
> , int FirstChannelBits = 0
> , int SecondChannelBits = 0
> , int ThirdChannelBits = 0
> , int FourthChannelBits = 0
> , int FifthChannelBits = 0
> >
> struct pixel_type_generator { /* omitted*/ }
>
> The first parameter is different as it defines how many of the other
> parameters are actually used.
>
> How can I use boost::preprocessor to get this kind of code repetition:
>

<cut>

FWIW, this can be achieved with Boost.MPL instead of preprocessor.

Roman Perepelitsa.



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