Discussion:
[omniORB] Any Copy Constructor
Le Flour
2007-03-21 21:30:11 UTC
Permalink
Hi all ,
is there a way of making a deep copy of an Any type into another Any type ?
Many thanks for your answers.
Regards
Thierry Le Flour
--
Thierry Le Flour
Service Informatique
L.A.P.P. - BP 110, Chemin de Bellevue
74941 Annecy le Vieux cedex

Tel : (33) (0)4.50.09.17.31 - Fax : (33) (0)4.50.27.94.95
email: thierry.le-***@lapp.in2p3.fr
Carlos
2007-03-23 05:18:20 UTC
Permalink
Post by Le Flour
Hi all ,
is there a way of making a deep copy of an Any type into another Any type ?
Many thanks for your answers.
Regards
Thierry Le Flour
In page 1-66 of C++ Language Mapping Specification you have:

"The default constructor creates an Any with a TypeCode of type tk_null
and no value. The copy constructor calls _duplicate on the TypeCode_ptr
of its Any parameter and deep-copies the parameter?s value. The
assignment operator releases its own TypeCode_ptr and deallocates
storage for the current value if necessary, then duplicates the
TypeCode_ptr of its Any parameter and deep-copies the parameter?s
value. The destructor calls release on the TypeCode_ptr and deallocates
storage for the value, if necessary."

So

Any a = ....;

Any b(a);

or

Any b = a; // this calls copy constructor.

Cheers.

Carlos.

Continue reading on narkive:
Loading...