|
From: <ag...@us...> - 2012-01-28 18:15:26
|
Revision: 2695
http://zoolib.svn.sourceforge.net/zoolib/?rev=2695&view=rev
Author: agreen
Date: 2012-01-28 18:15:20 +0000 (Sat, 28 Jan 2012)
Log Message:
-----------
Add Mutable.
Modified Paths:
--------------
trunk/zoolib/source/cxx/zoolib/ZAny.h
Modified: trunk/zoolib/source/cxx/zoolib/ZAny.h
===================================================================
--- trunk/zoolib/source/cxx/zoolib/ZAny.h 2012-01-28 18:15:00 UTC (rev 2694)
+++ trunk/zoolib/source/cxx/zoolib/ZAny.h 2012-01-28 18:15:20 UTC (rev 2695)
@@ -118,6 +118,16 @@
bool Is() const
{ return this->PGet<S>(); }
+ template <class S>
+ S& Mutable()
+ {
+ if (S* theP = this->PGetMutable<S>())
+ return *theP;
+ pDtor();
+ pCtor_T<S>(S());
+ return *this->PGetMutable<S>();
+ }
+
// Special purpose constructors, called by sAny and sAnyCounted
template <class S, class P0>
ZAny(const S* dummy, const P0& iP0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|