AlisdairM wrote:
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 };
Are you sure? An aggregate can not have user defined constructors, but I believe user defined assignment operators ar OK. I tested with VC++ 7.1, and there my fix can be combined with aggregate initialization. (If I add a constructor though, then aggregate initialization does not work with VC++ 7.1.) So I think my fix works.
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 no idea. The error only seems to pop up in fairly complex situations with templates and pointer-to-members.