Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-10-11 14:56:37

Alexander Nasonov <alnsn_at_[hidden]> writes:

> Jonathan Turkanis wrote:
>> "Tobias Schwinger" <tschwinger_at_[hidden]> wrote in message
>> > However, I guess you are talking about another as_sequence distinct
>> > from
>> > mpl::as_sequence...
>> Yes, I misunderstood the question. I don't like the idea of
>> 'overloading'
>> mpl::as_sequence this way, but generating sequences from function
>> types vice
>> versa seems like a legitimate request. I'm still not sure I see the
>> difficulty
>> though.
> Yes, I mean mpl::as_sequence. I know, overloading it this way is not a
> best idea but, I can think of mpl::as_sequence only as a sugar. That is,
> if template X accepts MPL sequence, you can pass an ordinary type if
> X has mpl::as_sequence underneath:
> X<mpl::vector<int> > // 1
> X<int> // 2 - sugar for 1
> Sequence concept is mixed up with ordinary types but if you tell a user
> about it, they can accept it.
> If mpl::as_sequence treated function types as I suggest, it could
> introduce more sugar:
> X<int(char)> // 3 - sugar for mpl::vector<int,char>
> but this could confuse a user.

FWIW, we didn't cover as_sequence in the book because we really
couldn't come up with a use case that justified the non-uniformity in
generic programs. If the type you pass happens to be a sequence
already it gets treated differently :(.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at