heres the definition file..

mediandef.hpp

it includes <boost/lambda/lambda.hpp>

template <typename T,
         template <typename ELEM,typename = std::allocator<ELEM> >
         class CONT
 >
 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<T, std::allocator<_CharT> >&, typename CONT<T, std::allocator<_CharT> >::iterator, typename CONT<T, std::allocator<_CharT> >::iterator, typename CONT<T, std::allocator<_CharT> >::iterator)':
269 C:\cs classes\cs512b\c++\def\mediandef.hpp `_1' undeclared (first use this function)

i fix the other stuff... also i have a basic question.. how do you compile boost.python..

assuming your using dev-cpp inside c:\dev-cpp folder and your boost folder is in c:\boost_1_33_1...

On 8/3/06, François Duranleau <duranlef@iro.umontreal.ca> wrote:
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@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