Boost logo

Boost Users :

From: chun ping wang (cablepuff_at_[hidden])
Date: 2007-11-04 02:08:50


Never mind i found the problem.

First i need to do typedef long double longdouble so it will treat it
as two parameters, not three
Second i was passing a const vector of unordered_map.

On Nov 3, 2007 11:38 PM, chun ping wang <cablepuff_at_[hidden]> wrote:
> Hi I have a problem with boost::function in association with template.
>
> I have a gain function declaration declare as this..
> template <
> template <typename ELEM,typename = std::allocator<ELEM> >
> class CONT,
> typename T,
> typename U
> >
> long double gain(const CONT<boost::unordered_map<T, U> >& data,
> const T& attr, const T& target_attr);
> // old signature does compile
> template <
> template <typename ELEM,typename = std::allocator<ELEM> >
> class CONT,
> typename T,
> typename U
> >
> boost::any ID3(
> const CONT<boost::unordered_map<T, U> >&,
> const T&,
> const CONT<T> &,
> boost::function<long double (const
> CONT<boost::unordered_map<T, U> >&, const T&, const T&) >
> );
>
> // new signature DOES NOT compile.
> template <
> template <typename ELEM,typename = std::allocator<ELEM> >
> class CONT,
> typename T,
> typename U
> >
> boost::any ID3(
> const CONT<boost::unordered_map<T, U> >&,
> const T&,
> CONT<T> *,
> boost::function<long double (const
> CONT<boost::unordered_map<T, U> >&, const T&, const T&) >
> );
>
> In the main file i have things pass as this.
> // old way of passing works with old signature
> boost::any tree(
> MyAnn::ID3<std::vector, std::string, std::string>(data,
> target_attr, attribute,
> MyAnn::gain<std::vector, std::string, std::string>)
> );
> // line 76 to 82.
> boost::function<long double (const
> std::vector<boost::unordered_map<std::string, std::string>&, const
> std::string&,
> const std::string&)> gainfunc;
> gainfunc = MyAnn::gain<std::vector, std::string, std::string>;
> boost::any tree(
> MyAnn::ID3<std::vector, std::string, std::string>(data,
> target_attr, boost::addressof(attribute),
> gainfunc)
> );
>
> I compile the file and get teh following errors. Can anyone tell me
> why changing the orginial signature from const CONT<T>& to CONT<T> *
> all of sudden breaks the code. Thanks.
>


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