Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-05-06 01:14:43


On Wed, 05 May 2004 20:14:18 +0200, John Torjo wrote:

> struct base {
> int i;
> };
>
> struct test : public base {
> // if you uncomment here and comment above, it'll work
> // int i;
> };
>
> int main() {
> typedef std::vector<test> vector;
> vector v;
> // generates compile-time error on vc7.1
> bind<int&>( mem_fn(&test::i), _1) (v.front());
> return 0;
> }

it also fails in other compilers, notably Comeau compiler in relaxed and
strict mode. Here's error message:

"C:\WINGNU\boost_1_31_0\boost/bind.hpp", line 193: error #433: qualifiers
          dropped in binding reference of type "boost::_bi::bind_t<int &,
          boost::_mfi::dm<int, base>,
          boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B1>>::result_
          type" to initializer of type "const int"
          return unwrap(f, 0)(a[a1_]);
                 ^
          detected during:
            instantiation of "R
                      boost::_bi::list1<A1>::operator()(boost::_bi::type<R>,
                      F, A &) [with
                      A1=boost::_bi::list_av_1<boost::arg<1>>::B1,
                      R=boost::_bi::bind_t<int &, boost::_mfi::dm<int, base>,
                      boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>::B
                      1>>::result_type, F=boost::_mfi::dm<int, base>,
                      A=boost::_bi::list1<std::vector<test,
                      std::allocator<test>>::value_type &>]" at line 33 of
                      "C:\WINGNU\boost_1_31_0\boost/bind/bind_template.hpp"
            instantiation of "boost::_bi::bind_t<R, F, L>::result_type
                      boost::_bi::bind_t<R, F, L>::operator()(A1 &) [with
                      R=int &, F=boost::_mfi::dm<int, base>,
                      L=boost::_bi::list1<boost::_bi::list_av_1<boost::arg<1>>:
                      :B1>, A1=std::vector<test,
                      std::allocator<test>>::value_type]" at line 20 of
                      "T313.cpp"

(I hope above lines won't get wrapped)

Regards

B.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk