boost python noobie questions
Hey I have several problem...
A.) Can boost::python work with templated argument...
Example:
/************************************************
* rsa(p, q): *
* let n = p * q *
* let totient = (p-1)*(q-1) *
* choose integer e between 1 and totient *
* such that greatest common denominator is 1 *
* d = (1 mod totient) / e *
* return e, d, n *
************************************************/
template <class T>
boost::tuple
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
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 CONT> double MyAnn::getCondProb(const T& A, const T& B, const CONT >& 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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
heres the definition file..
mediandef.hpp
it includes
::iterator, typename CONT
>::iterator, typename CONT >::iterator)': 269 C:\cs classes\cs512b\c++\def\mediandef.hpp `_1' undeclared (first use
T select(const CONT<T>& a,
typename CONT<T>::iterator k,
typename CONT<T>::iterator left,
typename CONT<T>::iterator right)
{
using namespace boost::lambda;
typedef typename CONT<T>::iterator iter;
while (true)
{
// iter q(random_partition(a, left, right, k));
iter q(std::stable_partition(left, right, _1 < *k));
if (k == q)
return *q;
else
{
(k < q) ? right = --q : left = ++q;
}
}
}
C:\cs classes\cs512b\c++\def\mediandef.hpp In function `T select(const
CONT
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
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 CONT> double MyAnn::getCondProb(const T& A, const T& B, const CONT >& 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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
chun ping wang
-
François Duranleau