Re: vtable on stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Axel Freyn wrote:
There is also another possibilty you could maybe think about: If you
create an additional structure, which "caches" the pointer to A or B and
returns references to it, you can have this new structure living on the
stack - and do with it whatever you want (e.g. you can insert it into a
std::vector without problems):
struct Cache{
  Cache( A* _a):a(_a){}
  A *a;
  A& operator()(){ return *a;}
};
I like this whole thing, but wouldn't operator* be more natural to return the reference?

Patrick


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux