I have a program I need to change. There is a class which is used as the member of a list. The list is a member of another class. I need to access the list from outside of both classes.
I tried something along the lines ofCode:/*
class c_message_bit
{
public:
string s_message_bit;
string s_type;
int i_bit_number; // simple count
string s_separator; // Any one from vector of separator
};
class c_message_element
{
public:
list <c_message_bit> l_A_message_bit;
};
but without success. It compiled but never entered the for loop.Code:list <c_message_bit> ::iterator ilocatorlist1;
for ( ilocatorlist1 = D1_message_element.l_D_message_bit.begin(); \
ilocatorlist1 != D1_message_element.l_D_message_bit.end(); \
++ ilocatorlist1 )
{
ilocatorlist1->............
}
I need to compare several of the lists stored within various instances of the main class.
Is there a way I can loop through the values of the list external to the classes?
And if not is there a simple way to copy the list to one declared on the outside?
The program is bit large and this requirement temporary so redesign is not an attractive route.
Thanks for any help. Nigel