How to copy RECT ?
I have a RECT with value in it
RECT Dest[2];
now I have a new RECT
RECT source[2];
how to make source equal Dest the easy way rather than the long method
source[0].top = Dest[0].top;
source[0].bottom = Dest[0].bottom;
.
.
.
.
source[1].left = Dest[1].left;
source[1].right = Dest[1].right;
Given that RECT is a structure with just data members, it's safe to use
If you were using the CRect class, then you could use the overloaded equal operator to perform a C++ style loop copy:
This allows the class to do anything it needs to on assignment.
[edited by - Zipster on March 17, 2003 7:22:50 PM]
memcpy
:memcpy(Dest, Source, 2 * sizeof(RECT));
If you were using the CRect class, then you could use the overloaded equal operator to perform a C++ style loop copy:
std::copy(source, source + 2, Dest);
This allows the class to do anything it needs to on assignment.
[edited by - Zipster on March 17, 2003 7:22:50 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement