![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Unverified User
Join Date: Mar 2006
Posts: 18
Rep Power: 0
![]() |
Adjacent data members
I have a class Vector. The first members I have typed into the class:
Scalar x; Scalar y; Scalar z; Scalar is a typedef for double. There are several other members (data and code) I examined this class at runtime and discovered that the doubles are not packed tightly in memory, ie: &x+sizeof(Scalar) != &y. This expression evaluates to true. Is there a way I can ensure they are adjacent in memory? I want to be able to use the data in calls to OpenGL array routines, but would rather avoid converting each Vector to a struct PackedVert3{Scalar x,y,x;}
__________________
Brent Two things are infinite: the universe and human stupidity; and Im not sure about the universe. -- Albert Einstein Last edited by coder0xff; Jun 2nd, 2006 at 12:22 PM. |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|