Section: 28.6 [numarray] Status: CD1 Submitter: Martin Sebor Opened: 2007-01-20 Last modified: 2016-01-28 10:19:27 UTC
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 28.6.5 [template.slice.array] and 188.8.131.52 [slice.arr.assign] as follows:
slice_array& operator= (const slice_array&);
Change the signature in 28.6.7 [template.gslice.array] and 184.108.40.206 [gslice.array.assign] as follows:
gslice_array& operator= (const gslice_array&);
Change the signature in 28.6.8 [template.mask.array] and 220.127.116.11 [mask.array.assign] as follows:
mask_array& operator= (const mask_array&);
Change the signature in 28.6.9 [template.indirect.array] and 18.104.22.168 [indirect.array.assign] as follows:
indirect_array& operator= (const indirect_array&);
[ Kona (2007) Added const qualification to the return types and set to Ready. ]