[boost] Re: [optional] Polymorphism

2003-02-28 Thread Philippe A. Bouchard
Fernando Cacciola wrote: [...] >> BTW implicit cast to reference types are not implicit under GCC, >> they have to be called explicitly. > > Yes, this is the conformant behaviour AFAIK But it will work if the cast operator is not a member template. Maybe "template cast to reference type" should

[boost] Re: [optional] Polymorphism

2003-02-27 Thread David B. Held
"Fernando Cacciola" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [...] > You would like to be dealing with: > > optional* and optional* Yes, exactly. > but you can do this as well, so I figure that what you really > need is a 'dynamic-type preserving' conversion between these > o

[boost] Re: [optional] Polymorphism

2003-02-27 Thread Fernando Cacciola
"Philippe A. Bouchard" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > > "Philippe A. Bouchard" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > [...] > > > int main() > > { > > optional b; > > optional c; > > > > foo(b); > > //foo(c); > > } > >

[boost] Re: [optional] Polymorphism

2003-02-27 Thread Philippe A. Bouchard
"Philippe A. Bouchard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [...] > int main() > { > optional b; > optional c; > > foo(b); > //foo(c); > } BTW implicit cast to reference types are not implicit under GCC, they have to be called explicitly. Template casts d

[boost] Re: [optional] Polymorphism

2003-02-26 Thread Philippe A. Bouchard
Philippe A. Bouchard wrote: [...] > void foo(optional const &) > { > } > > int main() > { > optional b; > optional c; > > foo(b); > //foo(c); > } There is a bool (m_initialized) that will prevent the pointer to access directly the virtual table. It may not be the case if the boo

[boost] Re: [optional] Polymorphism

2003-02-25 Thread Philippe A. Bouchard
David B. Held wrote: [...] > and then just store Base*, but this requires explicit run-time > checking of types which would otherwise be automatic with pointers to > T instead of optional. If this is the only solution, so be it; > but any clever alternatives are welcome. This example is not obj

[boost] Re: [optional] Polymorphism

2003-02-25 Thread Fernando Cacciola
"David B. Held" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > I think optional might be perfect for an issue I have, but there is one > catch. > I have a polymorphic hierarchy that I would like to use with optional, but > optional is not a base of optional. Of course, this is