Boost logo

Boost Users :

From: Chris Goller (goller_at_[hidden])
Date: 2005-11-30 00:37:02


I have code that will compile using msvc 7.1 but will not under intel 9.0.

Here is some simplified code to illustrate my problem:

   using namespace boost;
   using namespace std;
     typedef array<int, 2> array_type;

     array_type a;
   a[0] = 0; a[1] = 1;

   vector<array_type> v;
   v.push_back(a);
     vector<int> h;

   for_each(v.begin(), v.end(), mem_fun_ref(&array_type::front));

This compiles and runs using msvc 7.1, but intel 9.0 errors with the following:

error: more than one instance of overloaded function "mem_fun_ref"
matches the argument list:
           function template "std::mem_fun_ref(_Result (_Ty::*)() const)"
           function template "std::mem_fun_ref(_Result (_Ty::*)())"
           argument types are: (<unknown-type>)

Here are the two definitions of front for boost::array:
       reference front()
       {
           return elems[0];
       }
        const_reference front() const
       {
           return elems[0];
       }

If I'm reading the error correctly, this means that the intel compiler
doesn't know if
I want to use the const or non-const version of front.

Does anyone know anything about this? Is this the forwarding problem?
Is a function wrapper around front a good solution? What are the solutions?

Thanks,

Chris


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