
"Dirk Gregorius" <dirk@dirkgregorius.de> wrote in message news:000601c4c0dd$9f8cb280$0e2a9386@Erft... | Hi, | | 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 | { | public: | 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. br Thorsten