Created on 2007-01-20.00:00:00 last changed 172 months ago
Proposed resolution:
Declare the copy assignment operators of all four helper array class templates const.
Specifically, make the following edits:
Change the signature in [template.slice.array] and [slice.arr.assign] as follows:
const slice_array& operator= (const slice_array&) const;
Change the signature in [template.gslice.array] and [gslice.array.assign] as follows:
const gslice_array& operator= (const gslice_array&) const;
Change the signature in [template.mask.array] and [mask.array.assign] as follows:
const mask_array& operator= (const mask_array&) const;
Change the signature in [template.indirect.array] and [indirect.array.assign] as follows:
const indirect_array& operator= (const indirect_array&) const;
The computed and "fill" assignment operators of valarray
helper array class templates (slice_array
,
gslice_array
, mask_array
, and
indirect_array
) are const member functions of each class
template (the latter by the resolution of 123
since they have reference semantics and thus do not affect
the state of the object on which they are called. However, the copy
assignment operators of these class templates, which also have
reference semantics, are non-const. The absence of constness opens
the door to speculation about whether they really are intended to have
reference semantics (existing implementations vary widely).
Pre-Kona, Martin adds:
I realized that adding the const qualifier to the functions as I suggested would break the const correctness of the classes. A few possible solutions come to mind:
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg3240 |
2007-01-20 00:00:00 | admin | create |