#include <list>
using namespace std;
struct foo {
list<int> lst;
};
int main() {
// create
struct foo * x = (foo*) calloc(1, sizeof(struct foo));
// initialize
new (&x->lst) list<int>;
x->lst.clear();
// destroy
x->lst.~list<int>();
free(x);
}
class mud_channel
{
private:
mud_channel( const mud_channel & m );
mud_channel & operator=( const mud_channel & );
public:
mud_channel( );
~mud_channel( );
bitset < CHAN_MAXFLAG > flags;
string name;
string colorname;
char *history[MAX_CHANHISTORY][2]; /* Not saved */
time_t htime[MAX_CHANHISTORY]; /* Not saved *//* Xorith */
int hlevel[MAX_CHANHISTORY]; /* Not saved */
int hinvis[MAX_CHANHISTORY]; /* Not saved */
int level;
int type;
};
void init_memory( void *start, void *end, unsigned int size )
{
memset( start, 0, ( int )( ( char * )end + size - ( char * )start ) );
}
mud_channel::mud_channel( )
{
init_memory( &history, &type, sizeof( type ) );
}
channel = new mud_channel;
Which I believe is how I define a list for the custom skills. Problem is that it doesn't seem to be initialized. So I tried putting in a reference in some test code that calls
But doing so causes a seg fault. So my real question is, if I want to use iterators does the parent have to be a class instead of a structure? I'm just not sure if it has to do with the fact that I am calling the CREATE macro, which uses calloc, instead of using new to define the parent class. Anyways, any insight would be useful.
Thanks in advance,
KeB