4f99f3d0e5
2007-09-26 Benjamin Kosnik <bkoz@redhat.com> * include/bits/stl_algo.h: Add return type information to comments. * include/bits/algorithmfwd.h: Formatting. * testsuite/util/testsuite_hooks.h (NonDefaultConstructible): Move.. * testsuite/util/testsuite_api.h: ...here. Add necessary operators for use in testing chapters 25 and 26. * testsuite/util/testsuite_character.h: Same. * testsuite/25_algorithms/*/requirements/explicit_instantiation/ 2.cc, pod.cc: New. * testsuite/26_numerics/accumulate, adjacent_difference, inner_product, partial_sum/requirements/explicit_instantiation/2.cc, pod.cc: New. * testsuite/26_numerics/numeric_arrays/*: Move contents into testsuite/26_numerics. * testsuite/26_numerics/numeric_operations: Same. * testsuite/23_containers/*/requirements/explicit_instantiation/2.cc: Adjust includes from testsuite_eh.h to testsuite_api.h. Co-Authored-By: Chalathip Thumkanon <chalathip@gmail.com> From-SVN: r128822
38 lines
754 B
C++
38 lines
754 B
C++
// 19990805 gdr
|
|
//
|
|
// XXX: to impove later.
|
|
// Origin: Andreas Amann <amann@physik.tu-berlin.de>
|
|
// CXXFLAGS: -g
|
|
|
|
#include <iostream>
|
|
#include <valarray>
|
|
|
|
|
|
int main()
|
|
{
|
|
std::valarray<double> a(10), b(10), c(10), d(10);
|
|
|
|
a = 1.2;
|
|
b = 3.1;
|
|
|
|
c = 4.0;
|
|
|
|
d = ( 2.0 * b + a ); // works
|
|
std::cout << "d[4] = " << d[4] << std::endl;
|
|
|
|
d = (a * 2.0 + b ); // works
|
|
std::cout << "d[4] = " << d[4] << std::endl;
|
|
|
|
d = (a + b * 2.0 ); // segfaults!
|
|
std::cout << "d[4] = " << d[4] << std::endl;
|
|
d = (a + 2.0* b );
|
|
|
|
std::cout << "d[4] = " << d[4] << std::endl;
|
|
d = (a + 2.0* b );
|
|
std::cout << "d[4] = " << d[4] << std::endl;
|
|
d = (a + 2.0* b );
|
|
|
|
std::cout << "d[4] = " << d[4] << std::endl;
|
|
return 0;
|
|
}
|