OpenMP-Examples/sources/Example_udr.5.cpp

22 lines
414 B
C++

/*
* @@name: udr.5.cpp
* @@type: C++
* @@compilable: no
* @@linkable: no
* @@expect: success
*/
class V {
float *p;
int n;
public:
V( int _n ) : n(_n) { p = new float[n]; }
V( const V& m ) : n(m.n) { p = new float[n]; }
~V() { delete[] p; }
V& operator+= ( const V& );
#pragma omp declare reduction( + : V : omp_out += omp_in ) \
initializer(omp_priv(omp_orig))
};