The following code does not compile with VC++ 7.1 and Boost 1.33.1.
I believe the code should compile,
and that this is a VC++ 7.1 bug.
-----------------------------------------------------
#include
using boost::array;
struct X {
array f() { return array(); }
};
template
void g(X& x, T (X::*h)()) {}
void f() {
X x;
g(x, &X::f);
}
------------------------------------------------------
When I compile the code I get the bizarre error message
error C2664: 'g' : cannot convert parameter 2 from
'boost::array (__thiscall X::* )(void)'
to
'boost::array (__thiscall X::* )(void)'
with [T=int,N=4] and [T=int, N=4]
Types pointed to are unrelated;
conversion requires reinterpret_cast,
C-style cast or function-style cast
If I modify the array class by adding a non-templatized
assignment operator, as follows,
then the code does compile.
---------------------------------------------------------
namespace boost {
template
class array {
...
array& operator=(const array& rhs) {
std::copy(rhs.begin(), rhs.end(), begin());
return *this;
}
...
};
}
----------------------------------------------------------
So I propose that this assignment operator is added,
as a VC++ 7.1 bug workaround, to the array class.
I have contacted Nicolai Josuttis concerning this,
and he told me he is not maintaining the array library anymore.
--Johan Råde