|
Boost Users : |
Subject: Re: [Boost-users] mpl: generate kind of permutations
From: Hicham Mouline (hicham_at_[hidden])
Date: 2010-01-05 06:30:52
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Nat Goodspeed
> Sent: 05 January 2010 3:47
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] mpl: generate kind of permutations
>
> Hicham Mouline wrote:
>
> > I have 2 strictly ordered sequences of dates t1... tn, and td1...tdm,
where
> > m and n may or may not be different.
> > We always have: t1<...<tn and td1<...<tdm.
> >
> > I am trying to place the (t1...tn) sequence over the (td1...tdm)
sequence,
> > and generate all these "permutations" ie
>
> <snip examples>
>
> > I hope the description is clear enough even though it is not formal at
all.
>
> I'm sorry, maybe I wasn't trying hard enough to understand what you're
> trying to build here. I'm left with a hazy impression that you want to
> construct a merged sequence of dates, possibly including tag information
> identifying the original sequence from which a particular date came.
>
> But my notion of merge processing includes the idea of "consuming" items
> from the input sequences. I don't know how I'd attempt to implement that
> at compile time. Then again, I'm the wrong person to ask about MPL.
>
> Essentially I'm responding that no, I really didn't understand your
> problem statement. Perhaps a clearer restatement would prompt useful
> suggestions from others?
Taking my example from before, starting the dates vector with YYYYMMDD int
elements
mpl::vector_c< 20100109, 20100125, 20100322, 20100428 > tds; // requires
strictly sorted elements
and I want to place n=3 dates in buckets formed by the above 4 dates.
Let's say the way I choose the dates is 1 day, then 2 day, then 3days, less
the dates in tds.
So I want the metafunction to return the list of all mpl::vector_c<> that
have always 3 elements strictly sorted, so that
. all 3 dates < 20100109 ( 20100106 20100107 20100108 )
. 2 dates < 20100109 and 3rd date=20100109 ( 20100107 20100108 20100109 )
. ( 20100107 20100108 20100110 )
. ( 20100107 20100108 20100125 )
. ( 20100107 20100108 20100126 )
. ( 20100107 20100108 20100322 )
. ( 20100107 20100108 20100323 )
. ( 20100107 20100108 20100428 )
. ( 20100107 20100108 20100429 )
. 1 date < 20100109 and 2dates>=20100109 ( 20100108 20100109 20100110 )
. ( 20100108 20100109 20100125 )
. ( 20100108 20100109 20100126 )
. ( 20100108 20100109 20100322 )
. ( 20100108 20100109 20100323 )
. ( 20100108 20100109 20100428 )
. ( 20100108 20100109 20100429 )
. ( 20100108 20100110 20100111 )
. ( 20100108 20100110 20100125)
. ( 20100108 20100110 20100126 )
. ( 20100108 20100110 20100322 )
. ( 20100108 20100110 20100323 )
. ( 20100108 20100110 20100428 )
. ( 20100108 20100110 20100429 )
Etc
Etc
0 date<20100109 and 3dates>=20100109
The objective is to write the metafunction for generic tds vector, and
generic n (not just 3)
I hope this is clearer otherwise, I will write the complete list next time.
Regards,
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