This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 26.7 [numarray] Status: CD1 Submitter: Martin Sebor Opened: 2007-01-20 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [numarray].
View all issues with CD1 status.
The computed and "fill" assignment operators of
helper array class templates (
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:
Declare the copy assignment operators of all four helper array class templates const.
Specifically, make the following edits:
Change the signature in 26.7.5 [template.slice.array] and 126.96.36.199 [slice.arr.assign] as follows:
slice_array& operator= (const slice_array&);
Change the signature in 26.7.7 [template.gslice.array] and 188.8.131.52 [gslice.array.assign] as follows:
gslice_array& operator= (const gslice_array&);
Change the signature in 26.7.8 [template.mask.array] and 184.108.40.206 [mask.array.assign] as follows:
mask_array& operator= (const mask_array&);
Change the signature in 26.7.9 [template.indirect.array] and 220.127.116.11 [indirect.array.assign] as follows:
indirect_array& operator= (const indirect_array&);
[ Kona (2007) Added const qualification to the return types and set to Ready. ]