Title
Should valarray helper arrays fill functions be const?
Status
cd1
Section
[slice.arr.fill] [gslice.array.fill] [mask.array.fill] [indirect.array.fill]
Submitter
Judy Ward

Created on 1998-12-15.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

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.

Date: 2010-10-21.18:28:33

[ Redmond: Robert provided wording. ]

Date: 2010-10-21.18:28:33

Proposed resolution:

[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;
    

[slice.arr.fill] slice_array fill function

Change the function declaration

      void operator=(const T&);
    

to

      void operator=(const T&) const;
    

[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;
    

[gslice.array.fill] gslice_array fill function

Change the function declaration

      void operator=(const T&);
    

to

      void operator=(const T&) const;
    

[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;
    

[mask.array.fill] mask_array fill function

Change the function declaration

      void operator=(const T&);
    

to

      void operator=(const T&) const;
    

[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;
    

[indirect.array.fill] indirect_array fill function

Change the function declaration

      void operator=(const T&);
    

to

      void operator=(const T&) const;
    
Date: 1998-12-15.00:00:00

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 [slice.arr.assign] is const:

    void operator=(const valarray<T>&) const;

but this one in Section [slice.arr.fill] is not:

    void operator=(const T&);

The description of the semantics for these two functions is similar.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1243
2010-10-21 18:28:33adminsetmessages: + msg1242
2010-10-21 18:28:33adminsetmessages: + msg1241
1998-12-15 00:00:00admincreate