Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-03-16 11:45:09


Philippe A. Bouchard wrote:

[...]

>>>> It's pretty good. "ip_assign_op_switch" is faster than
>>>> "ip_offset_iterator" but must be explicit?
>>>>
>> I was afraid of that(as indicated in 6.2.2 of the .html file);
>> however, ip_offset_iterator
>> is more "robust" (as indicated in 6.2.3 item 2). Maybe some boost
>> template guru's
>> could figure a way to hack a "virtual template member function" as
>> mentioned in
>> item 4 of 6.1.2.
>
> A "virtual template member function". It looks like another virtual
> table will have to be gradually constructed at compile time, just
> like what I did last year with ptr<T, complex_tree>:
> http://groups.yahoo.com/group/boost/files/ptr/ptr.hpp.old. The table
> could return the address of the template member function given some
> class X and template parameter Y.

Here is a better example:
http://groups.yahoo.com/group/boost/files/shifted_ptr/virtualtemplate.cpp

Ouputs (compiled with gcc 3.0.4):
Normal calls:
void A::foo() [with U = int]
void B::bar() [with U = int]
Virtual calls:
void A::foo() [with U = int]
void B::bar() [with U = int]

Philippe


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