|
Boost : |
From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-01-29 14:37:02
>From: "David B. Held" <dheld_at_[hidden]>
> "Gabriel Dos Reis" <gdr_at_[hidden]> wrote in message
> news:m34r7rvovp.fsf_at_uniton.integrable-solutions.net...
> > [...]
> > There is no formal vote about these thingies yet.
>
> Well, I just wanted to know what the most popular opinion was,
> and you give some interesting info here.
>
> > [...]
> > template<typename T>
> > Vec = std::vector<T, MyAlloc<T> >;
>
> This looks cool! Is someone going to write a proposal for this before
> April? Or does this type of change not get considered at that time?
>
> > [...]
> > Oh well, I believe we're very far from any actual definitive form of
> > "template typedef" or "template aliasing".
>
> Well, I thought Herb's proposal was more or less "definitive". Is that
> not what's likely to be presented to the committee? If we got template
> aliasing as you describe above, then Herb's proposal is just fine with
> me.
Yeah. It's probably hard to perform deduction in the presence of
specialisations. If that turns out very hard or impossible, then having a
specialisable (non-deducible) template typedef, and deducible template
aliasing, might mean that we could have our cake and eat it, too. :)
Thus, we could have the benefits of specialisation, for example (from the
proposal):
template<int> typedef int int_exact;
template<> typedef char int_exact<8>;
template<> typedef short int_exact<16>;
// ...
template<class T> typedef T remove_const;
template<class T> typedef T remove_const<T const>;
As well as deducability (using the example above):
template<typename T>
Vec = std::vector<T, MyAlloc<T> >;
template<typename T, typename A>
void f(std::vector<T, A>);
f(Vec<int>); // Deduces T=int and A=MyAlloc<T>
As well as, of course:
template<typename T>
some_pointer = smart_ptr<T, ...>
Regards,
Terje
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk