Boost logo

Boost Users :

From: Marco Correia (mvc_at_[hidden])
Date: 2006-02-03 01:57:07


hi,

I would like to ask if there is a way boost::preprocessor may be used to solve
the following problem:

The problem is to define a macro that expands to the concatenation of their
arguments, without duplicates. The arguments are symbols belonging to a known
alphabet.

For example, one possible solution for a macro which can take 3 symbols from
the alphabet (A,B,C), would be

#define RemoveDuplicates(S1,S2,S3) S1 ## S2 ## S3
#define AAA A
#define AAB AB
#define ABA AB
#define ABB AB
#define BAA AB
#define BAB AB
#define BBA AB
#define BBB B

In my real problem I have an alphabet of 10 symbols, which would be solved
similarly with 10^10 #defines instructions, which is too much for the
c++ preprocessor. So finally, is there any way boost::preprocessor can help me
on this? And also, is there any paper or other document explaining how does
boost::preprocessor works inside ?

thanks
Marco

-- 
Marco Correia <mvc_at_[hidden]>

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