|
-
September 7th, 2006, 02:02 AM
#1
STL vector - structure's vector
Hi guys,
I have a structure and a vector to a structure.
Code:
struct myParams
{
double angleOX;
double angleOY;
double angleOZ;
double trOX;
double trOY;
double trOZ;
double bandHeight;
};
------------
------------
std::vector<myParams> m_c_Vector;
And I use it into a code like that:
Code:
m_c_Vector.clear();
myParams s_param;
int x = 0;
do {
x = fscanf(file_stream,"%lf\t%lf\t%lf", &s_param.angleOX, &s_param.angleOY, &s_param.angleOZ);
m_c_Vector.push_back(s_param);
} while (x != 0);
Finaly, I have a structure's vector with some valid values on this used members but, some members sets by default, unemployed.
As you can see in the last code section, I'm not using all the members the myParams structure (e.g. trOX, trOY, trOZ, bandHeight). At that moment, I don't need to use this structure's members, but perhaps in the future, I'll need it. I designed myStruct right on this ideea.
I'm asking if that kind of design and writing code it's better than the designing of a smaller structure with the moment necessary members?
Regards.
Last edited by Maximus_X; September 7th, 2006 at 05:41 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|