[variant] pointers to using pointers

Help
Allen
2006-03-13
2013-05-14
  • Allen
    Allen
    2006-03-13

    What if the various values that a variant may contain are pointers to data that has been allocated via new? Surely there is a problem if the value of the variant object is changed,
    eg variant<T1*,T2*> vt;
       vt = new T1;
       vt = new T2;
    Am I missing something - is there some way of treating this in variant. Or do you just have to avoid doing this kind of thing with variant?