
"Thorsten Ottosen" wrote:
| It may be also useful to provide few more | clone managers in library: | | - possibly the one that is able to detect dynamic type | at runtime and properly contruct clone, w/o need | for special clone support in class,
hm... how would that work?
It is possible. Exception handlers store relation between types and such handlers could be generated by metaprogramming. The polymorphic_map uses this trick.
| - one using non-default allocator and then | placement new
can't you do that from within
T* allocate_clone( const T* ptr ) { return my_clone_func( ptr ); }
?
Yes but the clong would be separated into few pieces instead one.
| - one using serialization/deserialization to create | clone (the serialization process may for example | fluch internal caches or re-adjust some internal | structures)
hm...the thing is that the clone manager controls all cloning, also when clones are inserted coming from other containers...seems wierd to me.
It is weird but should work. I use this trick somewhere, so I put it as option. /Pavel