Hi guys
I want use the C++ STL to create a Linked Listed that has two items in a single node.
for example: an int and a float
So a single list can hold two different types.
How can I create this linked list.
Thank you for your help
Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard
struct two_item_thing {
int the_int;
float the_float;
};
std::list< two_item_thing > a_two_itemed_list;
Colin Jeanne wrote:
- Code: Select all
struct two_item_thing {
int the_int;
float the_float;
};
std::list< two_item_thing > a_two_itemed_list;
two_item_thing thing;
thing.the_int = 5;
thing.the_float = 5.5;
a_two_itemed_list.push_back(thing);
Return to Algorithms & Data Structures
Users browsing this forum: No registered users and 2 guests