[C++-sig] template function

David Abrahams dave at boost-consulting.com
Wed Aug 29 15:36:36 CEST 2007

on Wed Aug 29 2007, "Luca Sbardella" <luca.sbardella-AT-gmail.com> wrote:

> and used the export_test class to export to python. For example
> export_test<double,double>("test_real");
> Everything works fine if I comment
> .def("keys",       &etest::keys<L>)
> in the export_test. All the member functions of test are available in Python.
> However if I insert the .def("keys",       &etest::keys<L>)  the code will not
> compile!!!
> Am I missing something?

Yeah, &etest::keys<L> isn't valid C++ unless L is a type.  It isn't,
in your case.  You can't take the address of a (member) function
template; you can only take the address of a particular specialization
(instance) of that template, so you need to substitute a real, concrete
type name for L.


Dave Abrahams
Boost Consulting

The Astoria Seminar ==> http://www.astoriaseminar.com

More information about the Cplusplus-sig mailing list