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: 28.6.5.4 [slice.arr.fill], 28.6.7.4 [gslice.array.fill], 28.6.8.4 [mask.array.fill], 28.6.9.4 [indirect.array.fill] Status: CD1 Submitter: Judy Ward Opened: 1998-12-15 Last modified: 2016-01-28
Priority: Not Prioritized
View all issues with CD1 status.
Discussion:
One of the operator= in the valarray helper arrays is const and one is not. For example, look at slice_array. This operator= in Section 28.6.5.2 [slice.arr.assign] is const:
void operator=(const valarray<T>&) const;
but this one in Section 28.6.5.4 [slice.arr.fill] is not:
void operator=(const T&);
The description of the semantics for these two functions is similar.
Proposed resolution:
28.6.5 [template.slice.array] Template class slice_array
In the class template definition for slice_array, replace the member function declaration
void operator=(const T&);with
void operator=(const T&) const;
28.6.5.4 [slice.arr.fill] slice_array fill function
Change the function declaration
void operator=(const T&);to
void operator=(const T&) const;
28.6.7 [template.gslice.array] Template class gslice_array
In the class template definition for gslice_array, replace the member function declaration
void operator=(const T&);with
void operator=(const T&) const;
28.6.7.4 [gslice.array.fill] gslice_array fill function
Change the function declaration
void operator=(const T&);to
void operator=(const T&) const;
28.6.8 [template.mask.array] Template class mask_array
In the class template definition for mask_array, replace the member function declaration
void operator=(const T&);with
void operator=(const T&) const;
28.6.8.4 [mask.array.fill] mask_array fill function
Change the function declaration
void operator=(const T&);to
void operator=(const T&) const;
28.6.9 [template.indirect.array] Template class indirect_array
In the class template definition for indirect_array, replace the member function declaration
void operator=(const T&);with
void operator=(const T&) const;
28.6.9.4 [indirect.array.fill] indirect_array fill function
Change the function declaration
void operator=(const T&);to
void operator=(const T&) const;
[Redmond: Robert provided wording.]
Rationale:
There's no good reason for one version of operator= being const and another one not. Because of issue 253, this now matters: these functions are now callable in more circumstances. In many existing implementations, both versions are already const.