Strongly typed boxed values and reference to them...
I just found this on my hard-disk. I thought I would share:
int ^ stronglyTypedBoxedValue = 1234 ; // C++/CLI feature
int copyOfUnboxedValue = *stronglyTypedBoxedValue ;
int % referenceIntoBox = *stronglyTypedBoxedValue ; // C++/CLI feature
referenceIntoBox = 4321 ; // Sets the value INSIDE the box!
Debug::Assert( copyOfUnboxedValue == 1234 ) ;
Debug::Assert( *stronglyTypedBoxedValue == 4321 ) ;
Debug::Assert( *stronglyTypedBoxedValue == referenceIntoBox ) ;
Check Boxing under C++: The Most Powerful Language for .NET Framework Programming if you're interested in those lines of code.
Comments
- Anonymous
February 20, 2006
Your site is realy very interesting.