[Omp] copy constructor vs. operator= when initializing
firstprivate variables
Richard Henderson
rth at twiddle.net
Wed Jul 12 13:36:13 PDT 2006
On Wed, Jul 12, 2006 at 09:09:07AM -0700, Chunhua Liao wrote:
> Good point, but setting operator= as private might cause problems for
> implementing lastprivate, copyprivate etc, where copy assignment
> operator is required.
That it's private here is instructional -- the program would not
compile if operator= were actually used.
> What I meant is something like this:
>
> void foo (S *p)
> {
> S s; //default constructor
> s= *p; //operator=
> }
>
> Obviously, this is an indirect way with a little performance penalty .
> But I think it is still legal if operator= is not private and default
> constructor is available.
Well, it isn't. That's not the way C++ (and thus OpenMP) works.
r~
More information about the Omp
mailing list