Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-12-20 22:23:45

Herb wrote:
> Issue the first: Would this require duplicating object code for unchanged
> components (i.e., double object sizes)? No; simply have a shared
> implementation (which might not even be templated) and write forwarding
> functions. This is usually a good idea when implementing templates anyway, for
> example for the container<void*> technique.

Easier answer: provide using-declarations to import names from older
namespaces into newer ones.

> Issue the second: Say vector<int> didn't change in any way. One problem,
> pointed out to me by Andy Koenig, is that std::vector<int> is not the same
> type as std200x::vector<int> and the code in #2(b) will not work when passed a
> std200x::vector<int>.

It's the same type if you've used a using-declaration.

> Apart from #2(b), I admit I find idea B seductive. Absent a magical new
> feature like namespace inheritance, it is not clear to me how to do achieve
> goal #2(b), but maybe that goal isn't important in itself. Does the solution
> get any better if we use a "white lie" and inherit std200x::vector<T> from
> std::vector<T>, in order to make #2(b) compile when passed a
> std200x::vector<int>? I haven't thought about this at all, but it seems it
> should blow up somehow. You'd probably have to duplicate some or all of the
> free operators, anyway.

Also, there's no way to go in the reverse direction if you do that, as there
should be since the types are really supposed to be equivalent.


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