high priority bugs T minus 2 days
Gabriel Dos Reis
Gabriel.Dos-Reis@cmla.ens-cachan.fr
Wed Jun 13 14:55:00 GMT 2001
Mark Mitchell <mark@codesourcery.com> writes:
| OK -- but just barely. I think if there is more like this, let's
| wait until a later release.
OK, so I just fixed the slice_array thing delaying other issues for a
later release.
| Also, spell `macth' as `match' in the comment. Also, should `copy'
| be capitalized in that comment? I don't know what the V3 conventions
| are.
Thanks for the catch.
Bootstrapped and tested on an i686-pc-linux.
-- Gaby
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/ChangeLog,v
retrieving revision 1.665
diff -p -r1.665 ChangeLog
*** ChangeLog 2001/06/13 17:51:33 1.665
--- ChangeLog 2001/06/13 21:52:06
***************
*** 1,3 ****
--- 1,14 ----
+ 2001-06-13 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
+
+ * testsuite/26_numerics/slice_array_assignment.cc (main): New test.
+
+ * include/bits/slice_array.h (slice_array<>::operator=): Make
+ public and implement.
+ (slice_array<>::slice_array): Make copy-constructor public.
+
+ * include/bits/valarray_array.h (__valarray_copy): Add another
+ overload to copy between strided arrays.
+
2001-06-13 Benjamin Kosnik <bkoz@redhat.com>
* acinclude.m4 (GLIBCPP_CONFIGURE): Bump version to 3.0.0.
Index: include/bits/slice_array.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/slice_array.h,v
retrieving revision 1.3
diff -p -r1.3 slice_array.h
*** slice_array.h 2001/03/04 21:34:00 1.3
--- slice_array.h 2001/06/13 21:52:06
*************** namespace std
*** 42,48 ****
{
public:
typedef _Tp value_type;
!
void operator= (const valarray<_Tp>&) const;
void operator*= (const valarray<_Tp>&) const;
void operator/= (const valarray<_Tp>&) const;
--- 42,54 ----
{
public:
typedef _Tp value_type;
!
! // This constructor is implemented since we need to return a value.
! slice_array (const slice_array&);
!
! // This operator must be public. See DR-253.
! slice_array& operator= (const slice_array&);
!
void operator= (const valarray<_Tp>&) const;
void operator*= (const valarray<_Tp>&) const;
void operator/= (const valarray<_Tp>&) const;
*************** namespace std
*** 87,99 ****
const size_t _M_sz;
const size_t _M_stride;
const _Array<_Tp> _M_array;
-
- // this constructor is implemented since we need to return a value.
- slice_array (const slice_array&);
// not implemented
slice_array ();
- slice_array& operator= (const slice_array&);
};
template<typename _Tp>
--- 93,101 ----
*************** namespace std
*** 108,113 ****
--- 110,124 ----
// template<typename _Tp>
// inline slice_array<_Tp>::~slice_array () {}
+
+ template<typename _Tp>
+ inline slice_array<_Tp>&
+ slice_array<_Tp>::operator=(const slice_array<_Tp>& __a)
+ {
+ __valarray_copy(_M_array, _M_sz, _M_stride, __a._M_array, __a._M_stride);
+ return *this;
+ }
+
template<typename _Tp>
inline void
Index: include/bits/valarray_array.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/valarray_array.h,v
retrieving revision 1.3
diff -p -r1.3 valarray_array.h
*** valarray_array.h 2001/02/19 18:52:25 1.3
--- valarray_array.h 2001/06/13 21:52:06
*************** namespace std
*** 252,257 ****
--- 252,269 ----
__valarray_copy (const _Tp* __restrict__ __a, _Tp* __restrict__ __b,
size_t __n, size_t __s)
{ for (size_t __i=0; __i<__n; ++__i, ++__a, __b+=__s) *__b = *__a; }
+
+ // Copy strided array __src[<__n : __s1>] into another
+ // strided array __dst[< : __s2>]. Their sizes must match.
+ template<typename _Tp>
+ inline void
+ __valarray_copy(const _Tp* __restrict__ __src, size_t __n, size_t __s1,
+ _Tp* __restrict__ __dst, size_t __s2)
+ {
+ for (size_t __i = 0; __i < __n; ++__i)
+ __dst[__i * __s2] = __src [ __i * __s1];
+ }
+
// copy indexed __a[__i[<__n>]] in plain __b[<__n>]
template<typename _Tp>
*************** namespace std
*** 378,383 ****
--- 390,402 ----
inline void
__valarray_copy (_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s)
{ __valarray_copy (__a._M_data, __b._M_data, __n, __s); }
+
+ template<typename _Tp>
+ inline void
+ __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s1,
+ _Array<_Tp> __b, size_t __s2)
+ { __valarray_copy(__a._M_data, __n, __s1, __b._M_data, __s2); }
+
template<typename _Tp>
inline void
Index: testsuite/26_numerics/slice_array_assignment.cc
===================================================================
RCS file: slice_array_assignment.cc
diff -N slice_array_assignment.cc
*** /dev/null Tue May 5 13:32:27 1998
--- slice_array_assignment.cc Wed Jun 13 14:52:06 2001
***************
*** 0 ****
--- 1,44 ----
+ // 20010613 gdr
+
+ // Copyright (C) 2001 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library. This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ // GNU General Public License for more details.
+
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING. If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ // USA.
+
+ // As a special exception, you may use this file as part of a free software
+ // library without restriction. Specifically, if other files instantiate
+ // templates or use macros or inline functions from this file, or you compile
+ // this file and link it with other files to produce an executable, this
+ // file does not by itself cause the resulting executable to be covered by
+ // the GNU General Public License. This exception does not however
+ // invalidate any other reasons why the executable file might be covered by
+ // the GNU General Public License.
+
+
+ // This is DR-253. Test for accessible assignment-operators.
+ #include <valarray>
+
+ int main()
+ {
+ std::valarray<double> v(10), w(10);
+ std::slice s(0, 0, 0);
+
+ v[s] = w[s]; // dg-do compile
+
+ std::slice_array<double> t = v[s];
+
+ return 0;
+ }
More information about the Libstdc++
mailing list