
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<T, T, T> boost::rsa_generate(const T& p, const T& q) { BOOST_STATIC_ASSERT(boost::is_integral<T>::value); assert(p != q); const T n(p*q); const T totient((p-1)*(q-1)); T e(3); for (e; EuclidBinaryGCD(e, totient) != 1; e = Random::randint(T(2), totient-1)); const T d(Inversemod(e, totient)); return boost::make_tuple(e, d, n); } BOOST_PYTHON_MODULE(rsa) { def("rsa_generate", boost::rsa_generate); } 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) { using namespace boost::lambda; typedef typename std::pair<T, T> MyPair; // gets the number of B const int numOfB ( std::count_if(DATA.begin(), DATA.end(), bind(&MyPair::second, _1) == B ) ); // gets the number of A given B. const int numOfAGivenB( std::count_if(DATA.begin(), DATA.end(), (bind(&MyPair::second, _1) == B) && (bind(&MyPair::first, _1) == A) ) ); return (numOfAGivenB*1.0)/numOfB; } now including this file.. and compling this gives error about "_1" BOOST_PYTHON_MODULE(bayesian) { def ("getCondProb", getCondProb<long long>); } Thanks for the help. If its the way i compile.. how i would i get it to work.. iam using dev-cpp 4.9