Boost logo

Boost Users :

From: Nelis Franken (nfranken_at_[hidden])
Date: 2006-08-21 14:53:27


Thanks for the suggestion Johan, but unfortunately that doesn't work
either. The error remains the same when int is replaced by ptrdiff_t
instead. I noticed a different error if I explicitly refer to
std::random_shuffle (as opposed to just random_shuffle). The "new" errors
(when using std::random_shuffle, and int instead of ptrdiff_t) are:

(apologies for the extensive error listing)

stl_sort.cpp:47: error: invalid initialization of non-const reference of
type 'boost::_bi::bind_t<int, boost::_mfi::mf1<int, Foo, int>,
boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> > >&' from a
temporary of type 'boost::_bi::bind_t<int, boost::_mfi::mf1<int, Foo,
int>, boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> > >'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_algo.h:1766: error:
in passing argument 3 of `void std::random_shuffle(_RandomAccessIterator,
_RandomAccessIterator, _RandomNumberGenerator&) [with
_RandomAccessIterator = __gnu_cxx::__normal_iterator<int*,
std::vector<int, std::allocator<int> > >, _RandomNumberGenerator =
boost::_bi::bind_t<int, boost::_mfi::mf1<int, Foo, int>,
boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> > >]'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_algo.h: In function
`void std::random_shuffle(_RandomAccessIterator, _RandomAccessIterator,
_RandomNumberGenerator&) [with _RandomAccessIterator =
__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> >
>, _RandomNumberGenerator = boost::_bi::bind_t<int, boost::_mfi::mf1<int,
Foo, int>, boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> > >]':
stl_sort.cpp:47: instantiated from here
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_algo.h:1775: error:
no match for call to `(boost::_bi::bind_t<int, boost::_mfi::mf1<int, Foo,
int>,boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> > >) (int)'
/usr/include/boost-1_33_1/boost/bind/bind_template.hpp:18: note:
candidates are: typename boost::_bi::result_traits<R, F>::type
boost::_bi::bind_t<R, F, L>::operator()() [with R = int, F =
boost::_mfi::mf1<int, Foo, int>, L =
boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> >]
/usr/include/boost-1_33_1/boost/bind/bind_template.hpp:24: note: typename
boost::_bi::result_traits<R, F>::type boost::_bi::bind_t<R, F,
L>::operator()()const [with R = int, F = boost::_mfi::mf1<int, Foo, int>,
L = boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> >]
/usr/include/boost-1_33_1/boost/bind/bind_template.hpp:30: note: typename
boost::_bi::result_traits<R, F>::type boost::_bi::bind_t<R, F,
L>::operator()(A1&) [with A1 = int, R = int, F = boost::_mfi::mf1<int,
Foo, int>, L = boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> >]
/usr/include/boost-1_33_1/boost/bind/bind_template.hpp:36: note: typename
boost::_bi::result_traits<R, F>::type boost::_bi::bind_t<R, F,
L>::operator()(A1&) const [with A1 = int, R = int, F =
boost::_mfi::mf1<int, Foo, int>, L =
boost::_bi::list2<boost::_bi::value<Foo*>, boost::arg<1> >]

Any ideas anyone?

Thanks again for your help.

Kind regards,
Nelis Franken

>
> The problem may be that int and ptrdiff_t are distinct types on your
> platform.
>
> Try the following:
>
> ptrdiff_t customRand(ptrdiff_t n) { return (rand() % n); }
>
> --Johan Råde
>
> _______________________________________________
> 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