Johan Råde wrote:
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.
The problem with that workaround is that the array template would no longer produce aggregate types, and we would lose the ability to use brace initialization: std::tr1::array< int, 4 > x = { 0, 1, 2, 3 }; That is an important motivating example for this library, and results in other compromises such as no user-declared constructors. Note that it has been accepted into standard library TR1 in this version, and the working draught for the next Standard Library. Hpwever, there may be language changes coming that will allow us to use brace-initialization with non-aggregate types. In that case we will definitely take another look at the class and see if we want to support this kind of code. I am also concerned that the patch involves overloading an operator that does not seem to be called anywhere in the example. It is an interesting test case though. i/ does it fail on other compilers? ii/ Is it a very specific failure with pointer-to-member, or the first hint of a more general issue that should be solved?
I have contacted Nicolai Josuttis concerning this, and he told me he is not maintaining the array library anymore.
Yes, I have taken on the maintenance now. Thanks for the report, although I don't have an instant solution :¬( -- AlisdairM