By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,925 Members | 1,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,925 IT Pros & Developers. It's quick & easy.

apply std::copy on arrays?

P: n/a
JDT
Hi,

I have the following two arrays (which is just a simplified example):
const int nSize = 5;
int x[nSize], y[nSize];

Is the following code has any side effect? In other words, is it one of
the right ways using std::copy? Thanks for any advise.

std::copy(x, x+nSize, y);

JD
Dec 19 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
JDT wrote:
Hi,

I have the following two arrays (which is just a simplified example):
const int nSize = 5;
int x[nSize], y[nSize];

Is the following code has any side effect? In other words, is it one of
the right ways using std::copy? Thanks for any advise.

std::copy(x, x+nSize, y);
Yes, this will work as desired.
Dec 19 '06 #2

P: n/a
On Tue, 19 Dec 2006 20:49:30 GMT in comp.lang.c++, JDT
<jd*******@yahoo.comwrote,
>int x[nSize], y[nSize];
std::copy(x, x+nSize, y);
Yes, perfectly OK.

Dec 19 '06 #3

P: n/a
Gianni Mariani wrote:
JDT wrote:
Hi,

I have the following two arrays (which is just a simplified example):
const int nSize = 5;
int x[nSize], y[nSize];

Is the following code has any side effect? In other words, is it one of
the right ways using std::copy? Thanks for any advise.

std::copy(x, x+nSize, y);

Yes, this will work as desired.
Only if all of the elements of x[] have been assigned values.

Dec 19 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.