Patrick Lam wrote:
>
> On Tue, 15 May 2001, Mike Nordell wrote:
>
> > >   void* getFirstItem() const;
> > >   void* getLastItem() const;
> >
> > These are also errors. Either they should be non-const, or they should
> > return const pointers.
>
> I tried to make them const, but then ut_stack::pop gives a warning.
>
> bool UT_Stack::pop(void ** ppVoid)
>
> Would it be ok to make pop instead have the following signature:
>
> bool UT_Stack::pop(const void* & ppVoid)

No, since a pop operation transfer ownership of the resource. But it would
be OK to overload getFirst/last item with non-const versions.

/Mike


Reply via email to