|
Boost Users : |
From: John Maddock (john_at_[hidden])
Date: 2006-07-26 05:01:26
Daryle Walker wrote:
>> 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.
Doh! Astonishing how much there is in this language to learn (still!)
Thanks for the correction,
John.
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