[C++-sig] design question

Neal Becker ndbecker2 at gmail.com
Thu Feb 22 17:51:50 CET 2007


Hans Meine wrote:

> Am Donnerstag, 22. Februar 2007 15:16 schrieb Neal Becker:
>> I'm interested in any ideas/opinions on the following.  I am building c++
>> objects that are compositions of pieces.  The composition is done from
>> python.
>> [...]
>> What I'm wondering is, is this a reasonable design?  Could it be made
>> significantly more efficient?
> 
> Looks OK to me - what exactly are you thinking about?
> 

I should have mentioned that both the pieces (a,b) and the larger object
that composes them (D) need to be in c++.

Without getting into too much detail, the use is

a = algorithm_a() # both of these are algorithms written in c++
b = algorithm_b()

d1 = D (a) # two D objects with different algorithms
d2 = D (b)

do_something_with (d1)
do_something_with (d2)

I guess I was wondering if the use of boost::shared_ptr would add even more
overhead to the virtual function calls, and if there was a more efficient
(but still easy) approach.





More information about the Cplusplus-sig mailing list