[GiNaC-list] hash tables and sets
Richard B. Kreckel
kreckel at ginac.de
Thu Oct 12 22:34:14 CEST 2006
Marko Riedel wrote:
>Richard B. Kreckel writes:
> > I suppose that should work (I haven't actually tested it):
> >
> > typedef std::set<GiNaC::ex, GiNaC::ex_is_less> myset; // shorthand
> > myset* inst;
> > inst = (myset*)malloc(sizeof(myset)); // or get inst from elsewhere
> > new(inst) myset;
> > // do stuff to *inst here...
> > inst->~myset();
> > delete inst;
> >
>
>Okay, one last remark: the malloc should be matched up with a free,
>right? Giving the sequence
>
> inst = (myset*)malloc(sizeof(myset)); // or get inst from elsewhere
> new(inst) myset;
> // do stuff to *inst here...
> inst->~myset();
> free(inst);
>
Yes. The example I gave was in error.
-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>
More information about the GiNaC-list
mailing list