|
Boost : |
From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-03-06 06:47:36
on 3/6/00 6:41 AM, Kevin Atkinson at kevinatk_at_[hidden] wrote:
> Dave Abrahams wrote:
>> Patience, my son. Some ideas need time to gain understanding and acceptance.
>> This is an intruiguing approach; I never thought to use explicit
>> instantiation... but I still don't see what prevents some other client of
>> foo from getting a compiler error here:
>>
>> // client.cc
>> #include "foo.hh"
>> void f(Foo);
>> void g(const Foo& foo) {
>> f(foo); // <-- illegal use of incomplete type 'Bar1'
>> }
>
> No that's ok. I took GREAT pain to make sure that the code in
> copy_ptr.hh never requires the complete definition of Bar1. The worst
> thing that will happen is undefined references which the explicit
> installation takes care of. For compilers with export support that may
> not even be needed as copy_ptr-t.hh could be copy_ptr.cc but sense I
> don't have access to such a compiler I do not know for sure. I know my
> code works with modern versions of gcc and egcs which is a pretty good,
> except for the stdlib, as far as standard compliance goes.
>
> Sorry If i sound implatent I just get annoyed when people can't read my
> mind. :)
Wow, you learn something new every day. I never thought of doing this... but
of course it makes sense that the compiler doesn't require the definition of
a template function to be visible just so it can compile a use of that
function. That's pretty cool. In fact, I'll go out on a limb and say that
it's way cool.
>> Sorry, I _really_ must be missing something. How have you demonstrated the
>> need for non-owning CopyPtr above?
>
> What do you mean my non-owning. The point of the CopyPtr that it ALWAYS
> owns its object. The own flag is for the very special case when it
> doesn't and I don't even think I use it. It should be removed before
> includes in boost as it just confuses things.
That, I think, is exactly what my point was ;)
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk