On 7/25/06 2:05 PM, "John Maddock"
Peter Dimov wrote:
Likewise returning a C-array by value is not legal.
Sorry.
What makes you think that Boost.Array is not intended to be copy-constructable or assignable?
'cos I wasn't paying enough attention that's why :-)
It is assignable, just not copy-constructable (or at least not without a core change making arrays copy-constructable). I wasn't expecting copy-construction and assignment to behave differently and it confused me. Happens easily :-)
AFAIK, class types with (non-static) array members are _both_ assignable and copy-constructible. See section 12.8 in the 2003 C++ standard, paragraph 8 for the copy constructor and paragraph 13 for the assignment operator. But you MUST use the implicit copying routines, at least for the copy constructor, since arrays do _not_ have explicit copying semantics. This means that generally you must wrap array members in an private struct if you need non-implicit construction, using a private static member function that returns the array's initial value. See what I did with the "my_configuration::hook" class in "rational_test.hpp" for an example. Another part of this thread mentioned assignment operator templates. Please remember that C++ does not consider such templates when determining if an automatically-defined copying assignment operator is needed. Such an operator is always a non-template, even if there's a operator template with a pattern that could match. If automatically-defined copying assignment operator won't do what the assignment operator template would, then you must manually recreate the routine with an explicitly-defined non-template copying assignment operator. (A similar rule exists for the copy constructor, such that it won't consider possibly-matching constructor templates.) -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com