Re: [boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Terje Slettebø
>From: "Alan Bellingham" <[EMAIL PROTECTED]> > Terje Slettebø <[EMAIL PROTECTED]>: > > >>>in this thread, void * is type erasure. More or less the only safe thing you > >>>can do with it, is to delete it. You can also cast it back to its original > > [snip David Abrahams demurral] > > >Of course,

Re: [boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Alan Bellingham
Terje Slettebø <[EMAIL PROTECTED]>: >>>in this thread, void * is type erasure. More or less the only safe thing you >>>can do with it, is to delete it. You can also cast it back to its original [snip David Abrahams demurral] >Of course, it depends on whether the type supports polymorphic deletio

Re: [boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Terje Slettebø
>From: "David Abrahams" <[EMAIL PROTECTED]> > Terje Slettebø <[EMAIL PROTECTED]> writes: > > > I understand you (Johan) want to be able to have generic factories, but then > > erasing the type is probably not the way to go, and as has been pointed out > > in this thread, void * is type erasure. Mo

Re: [boost] Re: Re: dynamic_void_cast

2002-12-11 Thread David Abrahams
Terje Slettebø <[EMAIL PROTECTED]> writes: > I understand you (Johan) want to be able to have generic factories, but then > erasing the type is probably not the way to go, and as has been pointed out > in this thread, void * is type erasure. More or less the only safe thing you > can do with it, i

Re: [boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Terje Slettebø
>From: "Eric Woodruff" <[EMAIL PROTECTED]> > "Johan Nilsson" <[EMAIL PROTECTED]> wrote in message > at76e1$2ro$[EMAIL PROTECTED]">news:at76e1$2ro$[EMAIL PROTECTED]... > > Anyhow, in my opinion, dynamic_void_cast is completely unnecessary and takes > casts away the intent that it is _supposed_ to b

[boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Johan Nilsson
"Eric Woodruff" <[EMAIL PROTECTED]> wrote in message at7kru$5v7$[EMAIL PROTECTED]">news:at7kru$5v7$[EMAIL PROTECTED]... > > "Johan Nilsson" <[EMAIL PROTECTED]> wrote in message > at76e1$2ro$[EMAIL PROTECTED]">news:at76e1$2ro$[EMAIL PROTECTED]... > > > > "Eric Woodruff" <[EMAIL PROTECTED]> wrote in

[boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Eric Woodruff
"Johan Nilsson" <[EMAIL PROTECTED]> wrote in message at76e1$2ro$[EMAIL PROTECTED]">news:at76e1$2ro$[EMAIL PROTECTED]... > > "Eric Woodruff" <[EMAIL PROTECTED]> wrote in message > at542o$2hq$[EMAIL PROTECTED]">news:at542o$2hq$[EMAIL PROTECTED]... > > > > "Johan Nilsson" <[EMAIL PROTECTED]> wrote in

[boost] Re: Re: dynamic_void_cast

2002-12-11 Thread Johan Nilsson
"Eric Woodruff" <[EMAIL PROTECTED]> wrote in message at542o$2hq$[EMAIL PROTECTED]">news:at542o$2hq$[EMAIL PROTECTED]... > > "Johan Nilsson" <[EMAIL PROTECTED]> wrote in message > at52vi$si6$[EMAIL PROTECTED]">news:at52vi$si6$[EMAIL PROTECTED]... > [snip] > > > I'd like to be able to store referenc

Re: [boost] Re: Re: dynamic_void_cast

2002-12-10 Thread Terje Slettebø
>From: "Terje Slettebø" <[EMAIL PROTECTED]> > Fails: > > struct X { ~X() {} int n; }; > struct Y : X {}; > > Succeeds: > > struct X { ~X() {} }; > struct Y : X { int n; }; Sorry, the destructors should of course be virtual in the above. Terje ___ Unsu

Re: [boost] Re: Re: dynamic_void_cast

2002-12-10 Thread Terje Slettebø
>From: "Johan Nilsson" <[EMAIL PROTECTED]> > "Terje Slettebø" <[EMAIL PROTECTED]> wrote in message > > > > Here are the results: > > > > MSVC 6 - vptr at 0 - It works > > Intel C++ 7.0 - vptr at 0 - It works > > g++ 2.95.3 - vptr _not_ at zero - boom! :) It gives an OS protection error > > at the

Re: [boost] Re: Re: dynamic_void_cast

2002-12-10 Thread David Abrahams
"Johan Nilsson" <[EMAIL PROTECTED]> writes: > I'd like to be able to store references to objects of arbitrary types in a > homogenous collection, not requiring them to be derived from a common base > class. For COM users, that would be something like an "IUnknown in the > context of standard C++".

[boost] Re: Re: dynamic_void_cast

2002-12-10 Thread Eric Woodruff
"Johan Nilsson" <[EMAIL PROTECTED]> wrote in message at52vi$si6$[EMAIL PROTECTED]">news:at52vi$si6$[EMAIL PROTECTED]... [snip] > I'd like to be able to store references to objects of arbitrary types in a > homogenous collection, not requiring them to be derived from a common base > class. For COM

Re: [boost] Re: Re: dynamic_void_cast

2002-12-10 Thread Peter Dimov
From: "Johan Nilsson" <[EMAIL PROTECTED]> > "David Abrahams" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Incidentally, shared_ptr may allow you the kind of type erasure > > you want. Just a thought... > > I' afraid I don't really follow you. Wouldn't

[boost] Re: Re: dynamic_void_cast

2002-12-10 Thread Johan Nilsson
"David Abrahams" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > "Johan Nilsson" <[EMAIL PROTECTED]> writes: > > > "David Abrahams" <[EMAIL PROTECTED]> wrote in message > > > >> A rather lengthy example with no comments or explanatory text > >> describing what i

[boost] Re: Re: dynamic_void_cast

2002-12-10 Thread Johan Nilsson
[inlined] "Terje Slettebø" <[EMAIL PROTECTED]> wrote in message 011401c2a057$f404cf30$60fb5dd5@pc">news:011401c2a057$f404cf30$60fb5dd5@pc... > >From: "Peter Dimov" <[EMAIL PROTECTED]> > > > From: "Johan Nilsson" <[EMAIL PROTECTED]> > > > > > > "Peter Dimov" <[EMAIL PROTECTED]> wrote in message > >

[boost] Re: Re: dynamic_void_cast

2002-12-10 Thread Johan Nilsson
"Terje Slettebø" <[EMAIL PROTECTED]> wrote in message 00e001c2a04e$92f9c190$60fb5dd5@pc">news:00e001c2a04e$92f9c190$60fb5dd5@pc... > >From: "Johan Nilsson" <[EMAIL PROTECTED]> > > > > The hack makes no 'fixed' assumptions on binary object > > layout, rather, it relies on the fact that any polymorp