
24 Jan
2009
24 Jan
'09
8:50 p.m.
Steven Watanabe
AMDG
Jesse Perla wrote:
I am wondering what the best pattern/approach for a data structure that may contain either a reference or a copy of some data used in a constructor.[...]
If you don't need to decide at runtime whether to store a copy or a reference, then you can avoid the reference when you have a copy using static polymorphism:
[beatiful solution snipped] When the OP's post got to my mailbox, I rapidly put myself to work in a solution with the hope that Steven was asleep or somehow away from his computer, but he's done it again --beating eveybody to providing an answer, and with style too! It's not fair! Joaquín M López Muñoz Telefónica, Investigación y Desarrollo