$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2002-11-20 16:13:08
> David A. Greene wrote:
> > I'm starting to explore mpl a bit and I ran into a roadblock.
> > If I have a template that takes an argument that can be
> > a sequence (e.g. mpl::vector) or a regular old type, is
> > there any way, short of specialization, to determine whether
> > the parameter is a sequence?
>
> "is_sequence<T>::value", please expect it to appear in the CVS in a day or
> two :).
'That's exactly what I wanted in a thread "high order type traits and MPL".
Where you able to implement it without template template?
>
> > I'd like to avoid specializing the template based on mpl guts
> > that may change. Alternatively, is there any way to manipulate
> > the parameter to guarantee that it is converted to a sequence (of
> > one element) if it is not a sequence?
>
> Given 'is_sequence', it will be as simple as this:
>
> template< typename T >
> struct as_sequence
> : if_< is_sequence<T>, T, single_view<T> >
> {
> };
single_view?
> implement something like this:
>
> struct my_sequence_tag;
>
> struct first {
> typedef my_sequence_tag;
> >
> > I thought about designing some kind of wrapper that could
> > be used in specialization:
> >
> > template<typename Node>
> > struct intrusive_list {
> > typedef Node::type type;
> > };
> >
> > Then I could partially specialize begin<>/end<> on
> > intrusive_list. Is this a reasonable approach?
>
> It is, at least from the technical standpoint - 'begin/end' /
> 'begin_trait/end_trait' templates were intended to be specialized; I would
> need some user-level examples of intended usage for the whole thing to be
> able to judge if there is a better way here.
>
>
> >
> > Here's one final puzzle: I have two type vectors that
> > I'd like to merge into one. The trick is that I want
> > to eliminate all duplicates. Since types cannot be
> > ordered (how does one define a less-than operation?)
1. merge the sequences.
2. Eliminate the duplicates (for example like Loki is doing)
Gennadiy.