* include/bits/slice_array.h (slice_array<>::operator=): Fix typo.

From-SVN: r59984
This commit is contained in:
Gabriel Dos Reis 2002-12-10 07:39:51 +00:00 committed by Gabriel Dos Reis
parent 04a96e5e5c
commit 3e1fb0e194
3 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2002-12-07 Gabriel Dos Reis <gdr@integrable-solutions.net>
* include/bits/slice_array.h (slice_array<>::operator=): Fix typo.
2002-12-05 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Put _S_force_new into GLIBCPP_3.2.2.

View File

@ -120,7 +120,8 @@ namespace std
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);
__valarray_copy(__a._M_array, __a._M_sz, __a._M_stride,
_M_array, _M_stride);
return *this;
}

View File

@ -1,6 +1,6 @@
// 20010613 gdr
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002 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
@ -30,15 +30,21 @@
// This is DR-253. Test for accessible assignment-operators.
#include <valarray>
#include <testsuite_hooks.h>
int main()
{
std::valarray<double> v(10), w(10);
std::slice s(0, 0, 0);
using std::valarray;
using std::slice;
valarray<int> v(1, 10), w(2, 10);
v[s] = w[s]; // dg-do compile
w[slice(0, 3, 3)] = v[slice(2, 3, 3)];
std::slice_array<double> t = v[s];
VERIFY(v[0] == 1 && w[0] == 1);
VERIFY(v[3] == 1 && w[3] == 1);
VERIFY(v[6] == 1 && w[6] == 1);
std::slice_array<int> t = v[slice(0, 10, 1)];
return 0;
}