Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-01-04 10:19:49


>From: "Aleksey Gurtovoy" <agurtovoy_at_[hidden]>

> How would you call an 'apply' counterpart that takes a metafunction class
> and a _sequence_ of arguments, i.e.:
>
> typedef list_c<int,5,0> args;
> typedef apply_tuple< plus<>, args >::type sum; // this one
> BOOST_STATIC_ASSERT(sum::value == 5);
>
> ?
>
> If it was run-time C++, I would be happy with 'apply_tuple', but in MPL
> domain "tuple" isn't really the right word, and I don't like 'apply_seq'
or,
> worse yet, 'apply_sequence'. Or should it be 'seq_apply' (from an English
> language standpoint)?
>
> Anyway, suggestions and opinions are welcome!

I guess this is another good argument for class template overloading. Does
anyone know if this has been "formally" proposed for C0x? A quick search at
Google Groups turned up nothing.

With it, you might have used:

template<>
struct plus<default_type, default_type>
{
  template<class T1, class T2, class T3, class T4, class T5>
  struct apply { ... }

  template<class Sequence>
  struct apply { ... }
};

And what about partial specialisation of function templates? Could there be
a good chance to get that, as well? I guess these things depend much on
somebody writing a formal proposal. :)

Regards,

Terje


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk