[C++-sig] Exposing a template class
Stefan Seefeld
seefeld at sympatico.ca
Fri May 18 20:55:04 CEST 2007
Roman Yakovenko wrote:
> template< class T >
> void export_xx(const sd::string& name){
> boost::python::class_< T, ... >( name )
> ....
> ;
> }
>
> export_xx<X1>( "X1" );
> export_xx<X2>( "X2" );
> export_xx<X3>( "X3" );
or even:
template <class T>
void export_instance(std::string const &name)
{
boost::python::class_<your_class_template<T>, ...>(name.c_str())
...
}
export_instance<int>("int_container");
export_instance<float>("float_container");
> Than yes, you can do this.
>
By the way, what you are referring to as 'template class' is actually
a class template.
HTH,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
More information about the Cplusplus-sig
mailing list