G
Garma
When define member like "string" type for a class, we can either define it
as "char *" or "string." I don't know which one should be better. My
concern is that "string" has some "overhead" though its usage is so
convenient. Additionally 'string' member could be needed to pass into a
function which expect a variable of 'char *' Then the function call could
make the code looks like,
function(TheObject.PassMeTheStringMember().c_str(), 12, ...);
This is not that readable to me. I want to hear your opinion about this.
Another question is related to using STL. There are two classes, A and B:
class A
{
private:
list<Class B>InnerList;
....
};
class A contains a STL list. Could objects of type class A be put in
another std::list, OuterList (you see an iteration here)? Could it be put
in other type of container?
Thanks for your comments!
as "char *" or "string." I don't know which one should be better. My
concern is that "string" has some "overhead" though its usage is so
convenient. Additionally 'string' member could be needed to pass into a
function which expect a variable of 'char *' Then the function call could
make the code looks like,
function(TheObject.PassMeTheStringMember().c_str(), 12, ...);
This is not that readable to me. I want to hear your opinion about this.
Another question is related to using STL. There are two classes, A and B:
class A
{
private:
list<Class B>InnerList;
....
};
class A contains a STL list. Could objects of type class A be put in
another std::list, OuterList (you see an iteration here)? Could it be put
in other type of container?
Thanks for your comments!