Boost logo

Boost Users :

From: François Duranleau (duranlef_at_[hidden])
Date: 2006-08-04 02:00:04


On Thu, 3 Aug 2006, chun ping wang wrote:

> Hey I have several problem...
>
> A.) Can boost::python work with templated argument...
>
> Example:
>
> template <class T>
> boost::tuple<T, T, T> boost::rsa_generate(const T& p, const T& q)
> {
[snip]
> }
>
> BOOST_PYTHON_MODULE(rsa)
> {
> def("rsa_generate", boost::rsa_generate);
> }

[and]

> Second question.. how come lambda function don't work.
>
> COmpling this by itself..give no error.
>
> template <class T,
> template <typename ELEM,
> typename = std::allocator<ELEM> >
> class CONT>
> double MyAnn::getCondProb(const T& A, const T& B, const CONT<typename
> std::pair<T, T> >& DATA)
> {
[snip]
> }
>
> now including this file.. and compling this gives error about "_1"
>
> BOOST_PYTHON_MODULE(bayesian)
> {
> def ("getCondProb", getCondProb<long long>);
> }

For both def, you need to specify all template arguments. You can't take
the address of a function template otherwise. You need to decide which
instantiations to export.

As for _1, what's the reported error? Could it be a namespace problem?

-- 
François Duranleau
LIGUM, Université de Montréal
"Quand le dernier arbre sera abattu, la dernière rivière empoisonnée,
  le dernier poisson capturé, alors seulement vous vous apercevrez que
  l'argent ne se mange pas."
                                               - Prophétie d'un Indien Cree
    (cité par Marlo Morgan dans _Message des hommes vrais au monde mutant_)

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net