Re: C++ and Linked Lists

From: Akuma/Chris Baggett/DOOMer (doomer@BAYOU.COM)
Date: 03/15/98


At 01:52 PM 3/15/98 +0100, you wrote:
>Greetings,
>
>  You might consider using the container classes of the Standard
>Template Library? You'd then declare it like this:
>
>#include <vector>
>
>vector<clan_info> clan_array;
>
>You can add elements by:
>clan_array.push_back(some-clan-info);
>
>You can get the array size by:
>clan_array.size()
>
>and adress elements with the operator[]
>clan_array[x].somefield
>
>I use the STL in my code pretty much and am pretty content with it.
>Just a word of warning though: don't put pointers in STL containers,
>but just real instances.
>
>- Chris

Thanks for the insight, but if i can't put pointers in it, what's the
point? :-)
I need to store pointers to strings in it, along with other info
and I was wondering if it was possible to do something like that.

And I'm just wondering, but it IS possible to access private members
of a class if you declare the operator a friend (or is it virtual friend?)
am I correct?

this makes it possible to have a string class, and do something like this
string f, b;
char c[80];

f = b + c;
or
f = c + b;
if you have the the operator + (with a char sent to it) set as a friend of the
class.

I'm hoping i'm right, i thought I had read that somewhere.

Code On
Akuma the Raging Coder

  +------------------------------------------------------------+
  | "The poets talk about love, but what I talk about is DOOM, |
  |      because in the end, DOOM is all that counts." -       |
  |   Alex Machine/George Stark/Stephen King, The Dark Half    |
  |        "Nothing is IMPOSSIBLE, Just IMPROBABLE"            |
  |   "Easier Said Than Done, But Better Done Than Said..."    |
  +------------------------------------------------------------+


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST