|
Boost Users : |
From: Johan Råde (rade_at_[hidden])
Date: 2006-07-05 09:15:19
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 <boost/array.hpp>
using boost::array;
struct X {
array<int,4> f() { return array<int,4>(); }
};
template<class X, class T>
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<T,N> (__thiscall X::* )(void)'
to
'boost::array<T,N> (__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 T, std::size_t N>
class array {
...
array<T,N>& operator=(const array<T,N>& 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
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