This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [[patch] valarray (was Re: valarray_copy implementation question)


No, I was just posting the fix to my initial test case for information, since I agree with you that the src and dest size should be the same, and that size of dest is not size of dest[b] I don't have any issue now.

so

int main(void)
{
  int n = 2;

  valarray<int>  dest(n);
  valarray<bool> b(false, n);
  valarray<int>  src(1, n);

b[0] = foo();

dest[b] = src[b];

  cout << dest[0] << endl;
  cout << dest[1] << endl;

  return 0;
}

Works regardless of the mask_array initialization values.

Cheers

Christian

Gabriel Dos Reis wrote:
On Fri, Nov 27, 2009 at 3:02 AM, Christian BRUEL <christian.bruel@st.com> wrote:
Now that you established that it was a user bug, just wanted to slightly
correct the problem characterization by fixing the code with

 b[0] = foo();
 dest[b] = src[b];

so the problem was the "this" size really, not the runtime dependency on
foo(). Hope this could be of interest (regarding all the bogus examples I
found including the computed assignment variation).

Are you still having a problem with that? If yes, could you send a minimal complete program?

-- Gaby



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]