[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BUG #1589: The whole concept of forces/move_with_forces/forces_holde
From: |
David Philippi |
Subject: |
Re: BUG #1589: The whole concept of forces/move_with_forces/forces_holder needs to be rethought |
Date: |
Fri, 15 Nov 2002 18:03:09 +0100 |
User-agent: |
KMail/1.4.1 |
On Thursday 14 November 2002 23:21, Gervase Lam wrote:
> re-reading Ingo's sample code helped me. By doing this, I found the one
> bit of the code that prevented me from understanding it. And it wasn't to
> do with templates!
Just out of curiosity - what was it?
> However, I can think of one possible disadvantage of using member
> templates to achieve this. "Several" collision checking template
> functions with different function names would be needed. Overriding a
> virtual function would only require the one function name.
Well, you don't need differnt functions, you need functors. ;-)
In other words - the usual way is to define a class / struct which does the
required task in it's operator() and passes and object of the correct functor
to the template. If you ever try to learn more about the STL you'll see much
of those (but I wouldn't recommend doing this until you know more about C++
itself, the inner parts of the STL are not easy to understand).
> Oh well. Life is full of compromises.
And programming far far more. ;-)
Bye David