on Mon Oct 10 2011, Igor R
Every type in the sequence has the following form:
struct sequence_item { typedef the_real_type type ; static the_real_type *parse( const QDomElement & ) ; } ;
The code for iterating over the sequence is the following:
template < typename It, typename End > ?? *dispatchM( const QDomElement &, mpl::true_ /* endofvec */ ) { return 0 ; }
template < typename It, typename End > ?? *dispatchM( const QDomElement &element, mpl::false_ ) { typedef typename mpl::deref< It >::type MapEntry ; if ( element.tagName() == MapEntry::first::name() )
The above line means that you figure out the correct type in *run-time*, don't you? But the result type must be known in compile-time.
Yeah, as long as you're doing that with a runtime test, your only option is to use some kind of type erasure (boost::any, polymorphic base class, etc). If you are stuck with a runtime test, you might consider passing in a function object to handle whatever was going to be done at the outer level with full knowledge of the types. -- Dave Abrahams BoostPro Computing http://www.boostpro.com