Re: C++ and Linked Lists

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 03/15/98


On Sun, 15 Mar 1998, Akuma/Chris Baggett/DOOMer wrote:

->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.

I think he meant don't do,

  vector<char_data *> char_pointer_vector;

only do,

  vector<char_data> char_vector;

If he didn't and the STL actually has a limitation on using pointers
within data structures, I'm stunned.  It's not much of a "Standard
Template Library" for C++ if it prevents you from using one of the
more useful features of C and C++ (and pointers are just 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?

Why would you need to declare an operator a friend?  In your example,

->f = b + c;

The variable 'b' would contain the operator override function,
something like "string operator + (char *) const;".  The variable 'f'
would contain the operator override for equals and copy the data from
the string object returned by the + operator of 'b' using accessor
functions.

-dak


     +------------------------------------------------------------+
     | 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