A set of APIs that I commonly use follow a linked-list pattern:
struct SomeObject
{
const char* some_value;
const char* some_other_value;
SomeObj
I've seen some very good answers so far but I fear they might be "bare".
Before blindingly charge in let's examine the requirements.
forward_list
. Read up its interface, yours should come close.I would like to expose one very annoying fact though: who's responsible for the memory ?
I am worried because there's no copy
facility in the interface you've provided, so should we disable the copy constructor and assignment operator of our new list class ?
Implementation is easy, there's enough on this page even though the iterator
don't properly implement the iterator traits in general, but I would consider ditching this idea completely and move on to a better scheme:
class MyObject { public: ... private: SomeObject mData; };
GetObjectList
and returning a deque
, I guess the LONG
returns the number of items ?