Boost logo

Boost Users :

From: chun ping wang (cablepuff_at_[hidden])
Date: 2008-02-05 10:12:59


sorry i reply to wrong email. Please disregard.

On Feb 5, 2008 5:09 AM, chun ping wang <cablepuff_at_[hidden]> wrote:

> I am willing ot help out but i don't guaranteed i could make it on time..
> like yesterday i got back around 7:50ish ... and sometimes i come back at
> 8:20 to 8:30 so under mine.. make sure you put someone as backup...
>
> In Christ,
> Chun.
>
>
> On Feb 4, 2008 9:05 PM, Alexis H. Rivera-Rios <ahrivera_at_[hidden]> wrote:
>
> > Hi,
> >
> > I'm trying to use a transform iterator and lower_bound
> > to search a list of integers as if it was list of
> > booleans.
> >
> > According to the message the const_mem_fun_ref_t
> > doesn't have a default constructor. Is there a way to
> > make this code compile?
> >
> > Your help will be appreciated!
> > Alex
> >
> > #include<functional>
> > #include <vector>
> > #include <algorithm>
> > #include <boost/iterator/transform_iterator.hpp>
> >
> > class T
> > {
> > public:
> > int _a;
> > T(int a) : _a(a) {}
> > bool greaterZero() const { return _a > 0; }
> > };
> >
> > int main(void)
> > {
> > typedef std::vector<T> Tlist;
> > typedef std::const_mem_fun_ref_t<bool,T> Function;
> > typedef boost::transform_iterator<Function,
> >
> > Tlist::const_iterator> Iterator;
> >
> > Tlist x;
> > Iterator
> > b(x.begin(),std::mem_fun_ref<bool,T>(&T::greaterZero)),
> >
> > e(x.end(),std::mem_fun_ref<bool,T>(&T::greaterZero));
> >
> >
> > std::lower_bound(b,e,false);
> > }
> >
> >
> > Error log:
> > BD Software STL Message Decryptor v3.10 for gcc 2/3/4
> > matob.cpp:28:2: warning: no newline at end of file
> > /cygdrive/c/opt/boost_1_34_1/boost/iterator/transform_iterator.hpp:
> > In
> > constructor
> > `boost::transform_iterator<
> > main()::Function, vector<T>::const_iterator,
> > boost::use_default
> > , boost::use_default
> > >::transform_iterator()':
> > stl_algo.h:2627: instantiated from
> > `boost::transform_iterator<
> > main()::Function, vector<T>::const_iterator,
> > boost::use_default
> > , boost::use_default
> > > lower_bound(
> > boost::transform_iterator<
> > main()::Function,
> > vector<T>::const_iterator, boost::use_default
> > , boost::use_default
> > >, boost::transform_iterator<
> > main()::Function,
> > vector<T>::const_iterator, boost::use_default
> > , boost::use_default
> > >, const bool &
> > )'
> > matob.cpp:26: instantiated from here
> > /cygdrive/c/opt/boost_1_34_1/boost/iterator/transform_iterator.hpp:100:
> > error:
> > No match for `const_mem_fun_ref_t<bool,
> > T>::const_mem_fun_ref_t()'
> > stl_function.h:640: candidates are:
> > const_mem_fun_ref_t<bool, T>
> > ::const_mem_fun_ref_t(const
> > const_mem_fun_ref_t<bool, T> &)
> > stl_function.h:644: const_mem_fun_ref_t<
> > bool, T>::const_mem_fun_ref_t(bool (T::*)()
> > const)
> >
> >
> >
> > Programming Tutorial:
> > In Python: To do this, do this
> > In Perl: To do this, do this or this or this or this...
> > In C: To do this, do this, but be careful
> > In C++: To do this, do this, but don't do this, be careful of this,
> > watch out for this, and whatever you do, don't do this
> >
> >
> >
> > ____________________________________________________________________________________
> > Never miss a thing. Make Yahoo your home page.
> > http://www.yahoo.com/r/hs
> > _______________________________________________
> > 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