comparison anagram/support/agarray-imp.h @ 6:607e3be6bad8

Adjust to the moving target called the C++ standard. Apparently nowadays it's not allowed to define an explicit copy constructor but not an assignment operator. Consequently, defining the explicit copy constructor in terms of the implicit/automatic assignment operator for general convenience no longer works. Add assignment operators. Caution: not tested with the IBM compiler, but there's no particular reason it shouldn't work.
author David A. Holland
date Mon, 30 May 2022 23:46:22 -0400
parents 13d2b8934445
children
comparison
equal deleted inserted replaced
5:7661c1604e49 6:607e3be6bad8
89 (*this)[i] = c[i]; 89 (*this)[i] = c[i];
90 } 90 }
91 } 91 }
92 92
93 template <class T> 93 template <class T>
94 AgArray<T>::AgArray(const AgArray<T> &c)
95 : AgReferenceBase(c.size() ? new Kernel(c.size()) : 0)
96 {
97 //LOGSECTION("AgArray::AgArray(AgArray)");
98 //LOGV(c.size());
99 int n = c.size();
100 for (int i = 0; i < n; i++) {
101 (*this)[i] = c[i];
102 }
103 }
104
105 template <class T>
94 void AgArray<T>::copy(T *s, unsigned n) { 106 void AgArray<T>::copy(T *s, unsigned n) {
95 T *data = kernel().data; 107 T *data = kernel().data;
96 assert(n <= kernel().length); 108 assert(n <= kernel().length);
97 while (n--) { 109 while (n--) {
98 data[n] = s[n]; 110 data[n] = s[n];