From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-11-02 08:57:13
"Dirk Gregorius" <dirk_at_[hidden]> wrote in message
| I have a std::vector<boost::any> m_Processes containing several hydrological
| processes where a process is implemented like this:
| template<typename DerivedT>
| class Process
| DerivedT& asDerived( void )
| return static_cast<DerivedT&>( *this );
| void Apply( Subbasin& subbasin )
| asDerived().Apply( subbasin );
| Special Processes are derived from Process and pass their type as template
| argument ( Barton and Nackman Trick ).
no, you mean "the curiously recurring template idiom"
|I am writing a simulation software
| for hydrological simulation and want to test if I can get a better
| performance when getting rid of the virtual function overhead since all
| types are know at compile time.
have you measured that virtual functions are slowing the stuff down? Anyway, I
would expect boost.any + static dispatch is slower than
virtual dispatch in a class hierarchy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk