Reputation: 17
I have a code with a template class and a few data members, the code for vector looks like this
std::vector<Check> ck(100);
how would one go about making this into a linked list?
Upvotes: 2
Views: 538
Reputation: 227390
Like this:
std::list<Check> lck(ck.begin(), ck.end());
std::list
is a doubly-linked list.
If you want a singly linked list, you can use std::forward_list
:
std::forward_list<Check> lck(ck.begin(), ck.end());
Upvotes: 3