Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-02-07 05:53:31


From: "Beman Dawes" <bdawes_at_[hidden]>
> What is wrong with forwarding classes (until typedef templates make it
into
> the language)?
>
> template <typename T>
> struct specific_a : public generic<T, policy_a>
> { ... forwarding ctors, etc. };
>
> template <typename T>
> struct specific_b : public generic<T, policy_b>
> { ... forwarding ctors, etc. };
>
> At the cost of having to write and maintain more code, doesn't the above
> simulate:
>
> template <typename T>
> typedef generic<T, policy_a> specific_a;
>
> template <typename T>
> typedef generic<T, policy_b> specific_b;

No, it doesn't.

template<class A, class B> generic<A, B> f(generic<A, B>);
template<class A> void g(specific_a<A>);

g(f(specific_a<int>()));


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