← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1210677-autoptr into lp:zorba

 

Chris Hillery has proposed merging lp:~zorba-coders/zorba/bug-1210677-autoptr into lp:zorba.

Commit message:
Replace all instances of auto_ptr<> with unique_ptr<>. Add std::move() where
necessary. Remove #include <memory> where no longer necessary. Removed auto_vector.

Requested reviews:
  Paul J. Lucas (paul-lucas)
  Chris Hillery (ceejatec)
Related bugs:
  Bug #1210677 in Zorba: "Replace all uses of auto_ptr with unique_ptr"
  https://bugs.launchpad.net/zorba/+bug/1210677

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1210677-autoptr/+merge/180455
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1210677-autoptr/+merge/180455
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'NOTICE.txt'
--- NOTICE.txt	2013-08-14 04:28:02 +0000
+++ NOTICE.txt	2013-08-16 01:32:34 +0000
@@ -137,38 +137,6 @@
     
 ----------------------------------------------------
 
-src/util/auto_vector.h (has been modified)
-
-Copyright: 2003 Reliable Software
-
-
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions are met:
-
-      o  Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-      o  Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      o  The name of the author may not be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      POSSIBILITY OF SUCH DAMAGE.
-    
-----------------------------------------------------
-
 cmake_modules/FindBoost.cmake
 
 Copyright: 

=== modified file 'NOTICE.xml'
--- NOTICE.xml	2013-08-14 04:28:02 +0000
+++ NOTICE.xml	2013-08-16 01:32:34 +0000
@@ -121,36 +121,6 @@
     </foreign-notice>
   </foreign-files>
   <foreign-files>
-    <file is-modified="true">src/util/auto_vector.h</file>
-    <copyright>2003 Reliable Software</copyright>
-    <foreign-notice>
-      Redistribution and use in source and binary forms, with or without
-      modification, are permitted provided that the following conditions are met:
-
-      o  Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-      o  Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-      o  The name of the author may not be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-      ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-      CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      POSSIBILITY OF SUCH DAMAGE.
-    </foreign-notice>
-  </foreign-files>
-  <foreign-files>
     <file>cmake_modules/FindBoost.cmake</file>
     <copyright>
       2006-2008 Andreas Schneider &lt;mail@xxxxxxxxxxxx&gt;

=== modified file 'bin/debugger/command.h'
--- bin/debugger/command.h	2013-02-07 17:24:36 +0000
+++ bin/debugger/command.h	2013-08-16 01:32:34 +0000
@@ -23,11 +23,10 @@
 #include <set>
 #include <map>
 #include <sstream>
-#include <memory>
 #include <typeinfo>
 
 #include <zorba/config.h>
-
+#include <zorba/internal/unique_ptr.h>
 #include "command_arg.h"
 #include "tuple.h"
 
@@ -252,7 +251,7 @@
         return false;
       }
       const CommandArg<Tuple>& arg = *(pos->second);
-      std::auto_ptr<CommandArgInstance<Tuple> > instance;
+      std::unique_ptr<CommandArgInstance<Tuple> > instance;
       if (arg.isVoid()) {
         instance.reset(arg.parse("1"));
       } else {

=== modified file 'bin/debugger/main.cpp'
--- bin/debugger/main.cpp	2013-02-07 17:24:36 +0000
+++ bin/debugger/main.cpp	2013-08-16 01:32:34 +0000
@@ -34,7 +34,7 @@
 using namespace zorba::debugger;
 
 
-std::auto_ptr<XqdbClient> theClient;
+std::unique_ptr<XqdbClient> theClient;
 
 // this will make sure the xqdb process will not quit when Ctrl-C is pressed
 #ifdef WIN32
@@ -73,7 +73,7 @@
 
 
 int
-startZorba(std::string& aExec, std::vector<std::string>& aArgs, std::auto_ptr<ProcessListener>& aProcessListener) 
+startZorba(std::string& aExec, std::vector<std::string>& aArgs, std::unique_ptr<ProcessListener>& aProcessListener) 
 {
 #ifdef WIN32
   // **************************
@@ -343,7 +343,7 @@
     // start a zorba
 
     // This is a process listener used to watch the Zorba process termination.
-    std::auto_ptr<ProcessListener> lProcessListener;
+    std::unique_ptr<ProcessListener> lProcessListener;
 
     if (!lStandalone) {
       int lResult = startZorba(lZorbaExec, lZorbaArgs, lProcessListener);

=== modified file 'bin/zorbacmd.cpp'
--- bin/zorbacmd.cpp	2013-08-06 17:58:01 +0000
+++ bin/zorbacmd.cpp	2013-08-16 01:32:34 +0000
@@ -16,7 +16,6 @@
 
 #include "zorbacmdproperties.h"
 
-#include <memory>
 #include <iostream>
 #include <fstream>
 #include <sstream>
@@ -657,7 +656,7 @@
   std::ostringstream lOut;
   Zorba_CompilerHints lHints;
 
-  std::auto_ptr<std::fstream> planFile;
+  std::unique_ptr<std::fstream> planFile;
   std::fstream* planFilep = NULL;
 
   if (qfilepath.rfind(".jq") == qfilepath.size() - 3)
@@ -974,7 +973,7 @@
   bool compileOnly = (properties.compileOnly() || properties.libModule() );
 
   // write to file or standard out
-  std::auto_ptr<std::ostream> 
+  std::unique_ptr<std::ostream> 
   lFileStream(
       #ifdef ZORBA_WITH_FILE_ACCESS
         properties.outputFile().size() > 0 ?
@@ -1063,7 +1062,7 @@
     std::string fname = parseFileURI (properties.asFiles (), fURI);
     std::string path( fname );
     bool asFile = !fname.empty();
-    std::auto_ptr<std::istream> qfile;
+    std::unique_ptr<std::istream> qfile;
 
     if (asFile)
     {
@@ -1230,7 +1229,7 @@
         return 8;
       }
 
-      std::auto_ptr<std::istream> lXQ(new std::ifstream(path.c_str()));
+      std::unique_ptr<std::istream> lXQ(new std::ifstream(path.c_str()));
       std::string lFileName(path);
 
       zorba::XQuery_t lQuery;

=== modified file 'doc/cxx/examples/context.cpp'
--- doc/cxx/examples/context.cpp	2013-08-09 09:20:54 +0000
+++ doc/cxx/examples/context.cpp	2013-08-16 01:32:34 +0000
@@ -120,10 +120,10 @@
   std::ostringstream outStream1;
   std::ostringstream outStream2;
 
-  std::auto_ptr<std::istream> lDocStream1(
+  std::unique_ptr<std::istream> lDocStream1(
     new std::stringstream("<books><book>Book 1</book><book>Book 2</book></books>"));
 
-  std::auto_ptr<std::istream> lDocStream2(
+  std::unique_ptr<std::istream> lDocStream2(
     new std::stringstream("<books><book>Book 1.1</book><book>Book 2.2</book></books>"));
 
   try
@@ -183,7 +183,7 @@
 context_example_5(Zorba* aZorba)
 {
 
-  std::auto_ptr<std::istream> lDocStream(
+  std::unique_ptr<std::istream> lDocStream(
     new std::stringstream("<books><book>Book 1</book><book>Book 2</book></books>"));
 
   XQuery_t lQuery = aZorba->compileQuery("declare variable $var external; .//book");
@@ -372,7 +372,7 @@
       aUrl == "http://zorba.io/mymodule";) 
     {
       // we have only one module
-      std::auto_ptr<std::stringstream> lQuery(new std::stringstream());
+      std::unique_ptr<std::stringstream> lQuery(new std::stringstream());
       (*lQuery)
         << "module namespace mymodule = 'http://zorba.io/mymodule';" << std::endl
         << "import module namespace dml = 'http://www.zorba-xquery.com/modules/store/static/collections/dml';" << std::endl

=== modified file 'doc/cxx/examples/execution_plans.cpp'
--- doc/cxx/examples/execution_plans.cpp	2013-05-28 00:58:27 +0000
+++ doc/cxx/examples/execution_plans.cpp	2013-08-16 01:32:34 +0000
@@ -80,7 +80,7 @@
             }
             iter->close();
         }
-        // transfer ownership of the IteratorBackedItemSequence to Zorba (using an auto_ptr)
+        // transfer ownership of the IteratorBackedItemSequence to Zorba (using an unique_ptr)
         return ItemSequence_t(new IteratorBackedItemSequence(vec));
     }
 

=== modified file 'doc/cxx/examples/external_functions.cpp'
--- doc/cxx/examples/external_functions.cpp	2013-08-09 09:04:36 +0000
+++ doc/cxx/examples/external_functions.cpp	2013-08-16 01:32:34 +0000
@@ -141,7 +141,7 @@
       iter->close();
     }
 
-    // transfer ownership of the IteratorBackedItemSequence to Zorba (using an auto_ptr)
+    // transfer ownership of the IteratorBackedItemSequence to Zorba (using an unique_ptr)
     return ItemSequence_t(new IteratorBackedItemSequence(vec));
   }
   
@@ -253,7 +253,7 @@
 
   ItemSequence_t evaluate(const Arguments_t& args) const
   {
-    // transfer ownership of the IteratorBackedItemSequence to Zorba (using an auto_ptr)
+    // transfer ownership of the IteratorBackedItemSequence to Zorba (using an unique_ptr)
     return ItemSequence_t(new LazyConcatItemSequence(args));
   }
 
@@ -395,7 +395,7 @@
 
   ItemSequence_t evaluate(const ExternalFunction::Arguments_t& args) const
   {
-    // transfer ownership of the IteratorBackedItemSequence to Zorba (using an auto_ptr)
+    // transfer ownership of the IteratorBackedItemSequence to Zorba (using an unique_ptr)
     return ItemSequence_t(new LazyErrorReportingItemSequence(args));
   }
 
@@ -634,7 +634,7 @@
       aUrl == "http://zorba.io/mymodule";) 
     {
       // we have only one module
-      std::auto_ptr<std::istream> lQuery
+      std::unique_ptr<std::istream> lQuery
           (new std::istringstream
            ("module namespace lm = 'http://zorba.io/mymodule'; "
             "declare function lm:foo() { 'foo' }; "
@@ -713,7 +713,7 @@
 
   ItemSequence_t evaluate(const ExternalFunction::Arguments_t& args) const
   {
-    // transfer ownership of the IteratorBackedItemSequence to Zorba (using an auto_ptr)
+    // transfer ownership of the IteratorBackedItemSequence to Zorba (using an unique_ptr)
     return ItemSequence_t(new VectorItemSequence(theItems));
   }
 };

=== modified file 'doc/cxx/examples/module_import_check.cpp'
--- doc/cxx/examples/module_import_check.cpp	2013-02-07 17:24:36 +0000
+++ doc/cxx/examples/module_import_check.cpp	2013-08-16 01:32:34 +0000
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <memory>
 #include <sstream>
 #include <iostream>
 

=== modified file 'doc/cxx/examples/uri_resolvers.cpp'
--- doc/cxx/examples/uri_resolvers.cpp	2013-08-09 09:04:36 +0000
+++ doc/cxx/examples/uri_resolvers.cpp	2013-08-16 01:32:34 +0000
@@ -68,7 +68,7 @@
       aUrl == "http://zorba.io/mymodule";) 
     {
       // we have only one module
-      std::auto_ptr<std::istream> lModule
+      std::unique_ptr<std::istream> lModule
           (new std::istringstream
            ("module namespace lm = 'http://zorba.io/mymodule'; "
             "declare function lm:foo() { 'foo' };"));

=== modified file 'include/zorba/dynamic_context.h'
--- include/zorba/dynamic_context.h	2013-08-01 07:58:48 +0000
+++ include/zorba/dynamic_context.h	2013-08-16 01:32:34 +0000
@@ -18,7 +18,6 @@
 
 #include <time.h>
 #include <istream>
-#include <memory>
 
 #include <zorba/config.h>
 #include <zorba/api_shared_types.h>

=== modified file 'include/zorba/zorba_string.h'
--- include/zorba/zorba_string.h	2013-08-12 22:13:18 +0000
+++ include/zorba/zorba_string.h	2013-08-16 01:32:34 +0000
@@ -18,7 +18,6 @@
 #define ZORBA_STRING_API_H
 
 #include <iterator>
-#include <memory>
 #include <string>
 
 #include <zorba/config.h>

=== modified file 'modules/http-client/json/http-client.xq.src/http_client.cpp'
--- modules/http-client/json/http-client.xq.src/http_client.cpp	2013-07-09 10:54:49 +0000
+++ modules/http-client/json/http-client.xq.src/http_client.cpp	2013-08-16 01:32:34 +0000
@@ -178,8 +178,8 @@
 
       std::string lData;
 
-      std::auto_ptr<HttpRequestHandler> lHandler;
-      std::auto_ptr<RequestParser> lParser;
+      std::unique_ptr<HttpRequestHandler> lHandler;
+      std::unique_ptr<RequestParser> lParser;
       struct curl_slist* lHeaderList = 0;
 
       ErrorThrower thrower(aFactory, &lHeaderList,aTheModuleURI);
@@ -202,7 +202,7 @@
       bool lStatusOnly =
           lHandler.get() == NULL ? false : (lHandler->isStatusOnly() || lHandler->isHeadRequest());
       // This gives the ownership of lCurl to the HttpResponseParser
-      std::auto_ptr<HttpResponseParser> lRespParser(new HttpResponseParser(lRespHandler, lCURL, thrower,
+      std::unique_ptr<HttpResponseParser> lRespParser(new HttpResponseParser(lRespHandler, lCURL, thrower,
         lOverrideContentType.c_str(), lStatusOnly));
       int lRetCode = lRespParser->parse();
 
@@ -215,9 +215,9 @@
 
       // If the Parser is "self contained", that means it didn't create any
       // objects with a lifecycle longer than itself; therefore we should free
-      // it (by letting auto_ptr delete it). If the Parser is not self contained,
+      // it (by letting unique_ptr delete it). If the Parser is not self contained,
       // then it will have arranged for some other memory manager to free it
-      // later when appropriate; therefore we should NOT let auto_ptr delete it
+      // later when appropriate; therefore we should NOT let unique_ptr delete it
       // now.
       if ( ! lRespParser->selfContained()) {
         lRespParser.release();

=== modified file 'modules/http-client/json/http-client.xq.src/http_response_parser.cpp'
--- modules/http-client/json/http-client.xq.src/http_response_parser.cpp	2013-07-30 18:35:31 +0000
+++ modules/http-client/json/http-client.xq.src/http_response_parser.cpp	2013-08-16 01:32:34 +0000
@@ -124,7 +124,7 @@
         );
       }
 
-      std::auto_ptr<std::istream> lStream;
+      std::unique_ptr<std::istream> lStream;
       try {
         if ( !theCurrentCharset.empty() &&
              transcode::is_necessary( theCurrentCharset.c_str() ) ) {

=== modified file 'modules/http-client/json/http-client.xq.src/request_parser.cpp'
--- modules/http-client/json/http-client.xq.src/request_parser.cpp	2013-07-24 07:04:10 +0000
+++ modules/http-client/json/http-client.xq.src/request_parser.cpp	2013-08-16 01:32:34 +0000
@@ -205,7 +205,7 @@
   getString(aItem,"src",false,lSrc);
 
   std::vector<Item> lItems;
-  std::auto_ptr<VectorItemSequence> lSequence(new VectorItemSequence(lItems));
+  std::unique_ptr<VectorItemSequence> lSequence(new VectorItemSequence(lItems));
   theHandler->beginBody(lMediaType, lSrc, lSequence.get());
 
   Item lContentI;

=== modified file 'modules/org/expath/ns/file.xq.src/file.cpp'
--- modules/org/expath/ns/file.xq.src/file.cpp	2013-08-09 23:05:46 +0000
+++ modules/org/expath/ns/file.xq.src/file.cpp	2013-08-16 01:32:34 +0000
@@ -18,7 +18,6 @@
 
 // standard
 #include <fstream>
-#include <memory>
 #include <sstream>
 #include <stdexcept>
 

=== modified file 'modules/zorba-query/zorba-query.xq.src/zorba-query.cpp'
--- modules/zorba-query/zorba-query.xq.src/zorba-query.cpp	2013-08-13 19:19:44 +0000
+++ modules/zorba-query/zorba-query.xq.src/zorba-query.cpp	2013-08-16 01:32:34 +0000
@@ -473,8 +473,13 @@
     
   StaticContext_t ltempSctx = lZorba->createStaticContext();
 
+<<<<<<< TREE
   std::auto_ptr<ZorbaQueryURLResolver> lResolver;
   std::auto_ptr<ZorbaQueryURIMapper> lMapper;
+=======
+  std::unique_ptr<XQXQURLResolver> lResolver;
+  std::unique_ptr<XQXQURIMapper> lMapper;
+>>>>>>> MERGE-SOURCE
 
   if ( aArgs.size() > 2 )
   {
@@ -991,7 +996,7 @@
 
   XQuery_t lQuery = getQuery(aDctx, lQueryID);
 
-  std::auto_ptr<std::stringstream> lExcPlan;
+  std::unique_ptr<std::stringstream> lExcPlan;
   lExcPlan.reset(new std::stringstream());
   if (!lQuery->saveExecutionPlan(*lExcPlan.get()))
   {
@@ -1026,8 +1031,13 @@
   Zorba* lZorba = Zorba::getInstance(0);
   XQuery_t lQuery;
   
+<<<<<<< TREE
   std::auto_ptr<ZorbaQueryURLResolver> lResolver;
   std::auto_ptr<ZorbaQueryURIMapper> lMapper;
+=======
+  std::unique_ptr<XQXQURLResolver> lResolver;
+  std::unique_ptr<XQXQURIMapper> lMapper;
+>>>>>>> MERGE-SOURCE
   try
   {
     lQuery = lZorba->createQuery();

=== modified file 'src/api/auditimpl.cpp'
--- src/api/auditimpl.cpp	2013-04-03 22:52:25 +0000
+++ src/api/auditimpl.cpp	2013-08-16 01:32:34 +0000
@@ -16,12 +16,11 @@
 #include "stdafx.h"
 
 #include "api/auditimpl.h"
-
+#include <zorba/internal/unique_ptr.h>
 #include <iostream>
 #include <stdexcept>
 #include <cassert>
 #include <cstring>
-#include <memory>
 
 namespace zorba {
 namespace audit {
@@ -197,7 +196,7 @@
 void ConfigurationImpl::enableAudit(const String& aPropertyName) {
   DynPropsMap::const_iterator it = m_dyn_props.find(aPropertyName);
   if (it == m_dyn_props.end()) {
-    std::auto_ptr<PropertyImpl> lImpl(new PropertyImpl(aPropertyName));
+    std::unique_ptr<PropertyImpl> lImpl(new PropertyImpl(aPropertyName));
     m_dyn_props[aPropertyName] = lImpl.release();
   }
 }

=== modified file 'src/api/uri_resolver_wrappers.cpp'
--- src/api/uri_resolver_wrappers.cpp	2013-02-07 17:24:36 +0000
+++ src/api/uri_resolver_wrappers.cpp	2013-08-16 01:32:34 +0000
@@ -82,7 +82,7 @@
     static_context const& aSctx,
     std::vector<zstring>& oUris)
   {
-    std::auto_ptr<const EntityDataWrapper> lDataWrap
+    std::unique_ptr<const EntityDataWrapper> lDataWrap
         (EntityDataWrapper::create(aEntityData));
     if (lDataWrap.get() == NULL) {
       return;
@@ -127,7 +127,7 @@
   (const zstring& aUrl,
     internal::EntityData const* aEntityData)
   {
-    std::auto_ptr<const EntityDataWrapper> lDataWrap
+    std::unique_ptr<const EntityDataWrapper> lDataWrap
         (EntityDataWrapper::create(aEntityData));
     if (lDataWrap.get() == NULL) {
       return NULL;

=== modified file 'src/api/xqueryimpl.cpp'
--- src/api/xqueryimpl.cpp	2013-08-01 17:38:35 +0000
+++ src/api/xqueryimpl.cpp	2013-08-16 01:32:34 +0000
@@ -758,7 +758,7 @@
     {
       // this object is only need to construct the StaticCollectionManagerImpl
       // but it's not used after the construction anymore
-      std::auto_ptr<StaticContextImpl> lCtx(
+      std::unique_ptr<StaticContextImpl> lCtx(
       new StaticContextImpl(lIter->second.getp(), theDiagnosticHandler));
 
       lMgrs.push_back(new StaticCollectionManagerImpl(lCtx.get(),
@@ -1569,7 +1569,7 @@
     checkNotClosed();
     checkCompiled();
 
-    std::auto_ptr<IterPrinter> lPrinter;
+    std::unique_ptr<IterPrinter> lPrinter;
     if (aDotFormat)
       lPrinter.reset(new DOTIterPrinter(aStream));
     else

=== modified file 'src/capi/cdynamic_context.cpp'
--- src/capi/cdynamic_context.cpp	2013-02-07 17:24:36 +0000
+++ src/capi/cdynamic_context.cpp	2013-08-16 01:32:34 +0000
@@ -113,11 +113,11 @@
     if (! me->theContext->getContextItem(lItem)) {
       return XQC_NO_CURRENT_ITEM;
     }
-    std::auto_ptr<SingleItemSequence> lItemSeq(new SingleItemSequence(lItem));
+    std::unique_ptr<SingleItemSequence> lItemSeq(new SingleItemSequence(lItem));
     // Wrap in a CSequence to produce an XQC_Sequence. We pass
     // "true" to make CSequence assume memory-management
     // responsibility for the SingleItemSequence.
-    std::auto_ptr<CSequence> lSeq(new CSequence(lItemSeq.get(), true, NULL));
+    std::unique_ptr<CSequence> lSeq(new CSequence(lItemSeq.get(), true, NULL));
     lItemSeq.release();
     (*value) = lSeq.release()->getXQC();
     return XQC_NO_ERROR;
@@ -136,7 +136,7 @@
 //       std::stringstream* lStream = new std::stringstream();
 //       CAPIUtil::getIStream(document, *lStream); // must not throw
 
-//       lContext->setContextItemAsDocument(doc_uri, std::auto_ptr<std::istream>(lStream));
+//       lContext->setContextItemAsDocument(doc_uri, std::unique_ptr<std::istream>(lStream));
 //     DC_CATCH
 //   }
   
@@ -182,12 +182,12 @@
     // We could have gotten a single Item or an Iterator. We assume
     // the Item takes precedence if not null.
     if (! lItem.isNull()) {
-      std::auto_ptr<SingleItemSequence> lItemSeq
+      std::unique_ptr<SingleItemSequence> lItemSeq
         (new SingleItemSequence(lItem));
       // Wrap in a CSequence to produce an XQC_Sequence. We pass
       // "true" to make CSequence assume memory-management
       // responsibility for the SingleItemSequence.
-      std::auto_ptr<CSequence> lSeq
+      std::unique_ptr<CSequence> lSeq
         (new CSequence(lItemSeq.get(), true, NULL));
       
       lItemSeq.release();
@@ -196,7 +196,7 @@
     }
     
     // Otherwise, the Iterator must be the value.
-    std::auto_ptr<CSequence> lSeq (new CSequence(lIter, me->theErrorHandler));
+    std::unique_ptr<CSequence> lSeq (new CSequence(lIter, me->theErrorHandler));
     (*seq) = lSeq.release()->getXQC();
     return XQC_NO_ERROR;
   }
@@ -215,7 +215,7 @@
 //       CAPIUtil::getIStream(document, *lStream); // must not throw
 
 //       lContext->setVariableAsDocument(var_qname, doc_uri, 
-//                                       std::auto_ptr<std::istream>(lStream)); // transfer ownership here
+//                                       std::unique_ptr<std::istream>(lStream)); // transfer ownership here
 //     DC_CATCH
 //   }
 

=== modified file 'src/capi/cexpression.cpp'
--- src/capi/cexpression.cpp	2013-02-07 17:24:36 +0000
+++ src/capi/cexpression.cpp	2013-08-16 01:32:34 +0000
@@ -17,7 +17,6 @@
 
 #include "capi/cexpression.h"
 
-#include <memory>
 #include <cassert>
 #include <sstream>
 
@@ -90,7 +89,7 @@
       // one later.
       XQuery_t lClone = me->theMasterQuery->clone();
       DynamicContext* lContext = lClone->getDynamicContext();
-      std::auto_ptr<CDynamicContext> lCCtx
+      std::unique_ptr<CDynamicContext> lCCtx
         (new CDynamicContext(lContext, lClone, me->theErrorHandler));
       (*context) = lCCtx.release()->getXQC();
     }
@@ -209,7 +208,7 @@
       else {
         lHandler = me->theErrorHandler;
       }
-      std::auto_ptr<CSequence> lSeq(new CSequence(lIter, lHandler));
+      std::unique_ptr<CSequence> lSeq(new CSequence(lIter, lHandler));
 
       (*sequence) = lSeq.release()->getXQC();
     }

=== modified file 'src/capi/cexternal_function.cpp'
--- src/capi/cexternal_function.cpp	2013-02-07 17:24:36 +0000
+++ src/capi/cexternal_function.cpp	2013-08-16 01:32:34 +0000
@@ -68,7 +68,7 @@
     // the Zorba engine, so we request that CSequence NOT free them
     // when the CSequence is deleted.
     for (unsigned int i = 0; i < lSequencesSize; ++i) {
-      std::auto_ptr<CSequence> lSeq(new CSequence(args[i], false, NULL));
+      std::unique_ptr<CSequence> lSeq(new CSequence(args[i], false, NULL));
       lSequences[i] = lSeq.release()->getXQC();
     }
 

=== modified file 'src/capi/cimplementation.cpp'
--- src/capi/cimplementation.cpp	2013-08-05 11:24:53 +0000
+++ src/capi/cimplementation.cpp	2013-08-16 01:32:34 +0000
@@ -18,7 +18,6 @@
 #include "capi/cimplementation.h"
 
 #include <sstream>
-#include <memory>
 
 #include "capi/cexpression.h"
 #include "capi/cstatic_context.h"
@@ -149,17 +148,17 @@
    */
   void
   CImplementation::create_sequence
-  (std::auto_ptr<CrSeqData> data, XQC_Sequence** seq)
+  (std::unique_ptr<CrSeqData> data, XQC_Sequence** seq)
   {
     // Create a UserItemSequence to return the data in order as items.
-    std::auto_ptr<UserItemSequence> lItemSeq
+    std::unique_ptr<UserItemSequence> lItemSeq
       (new UserItemSequence(NULL, 0, &crseq_init, &crseq_next, &crseq_free,
         data.get(), theZorba->getItemFactory(), NULL));
 
     // Wrap in a CSequence to produce an XQC_Sequence. We pass "true"
     // to make CSequence assume memory-management responsibility for
     // the UserItemSequence.
-    std::auto_ptr<CSequence> lSeq (new CSequence(lItemSeq.get(), true, NULL));
+    std::unique_ptr<CSequence> lSeq (new CSequence(lItemSeq.get(), true, NULL));
 
     lItemSeq.release();
     data.release();
@@ -275,7 +274,7 @@
       // Create a C++ StaticContext, wrap in a CStaticContext, then
       // return the inner XQC_StaticContext
       StaticContext_t lContext = me->theZorba->createStaticContext();
-      std::auto_ptr<CStaticContext> lCCtx
+      std::unique_ptr<CStaticContext> lCCtx
         (new CStaticContext(lContext, me->theZorba, NULL));
       (*context) = lCCtx.release()->getXQC();
     }
@@ -301,7 +300,7 @@
         lQuery = me->theZorba->compileQuery(query_string);
       }
 
-      std::auto_ptr<CExpression> lExpr(new CExpression(lQuery, handler));
+      std::unique_ptr<CExpression> lExpr(new CExpression(lQuery, handler));
       (*expr) = lExpr.release()->getXQC();
     }
     CIMPL_CATCH;
@@ -331,7 +330,7 @@
         lQuery = me->theZorba->compileQuery(lStream);
       }
 
-      std::auto_ptr<CExpression> lExpr(new CExpression(lQuery, handler));
+      std::unique_ptr<CExpression> lExpr(new CExpression(lQuery, handler));
       (*expr) = lExpr.release()->getXQC();
     }
     CIMPL_CATCH;
@@ -361,7 +360,7 @@
         lQuery = me->theZorba->compileQuery(lStream);
       }
 
-      std::auto_ptr<CExpression> lExpr(new CExpression(lQuery, handler));
+      std::unique_ptr<CExpression> lExpr(new CExpression(lQuery, handler));
       (*expr) = lExpr.release()->getXQC();
     }
     CIMPL_CATCH; 
@@ -376,11 +375,11 @@
       return XQC_INTERNAL_ERROR;
     }
 
-    std::auto_ptr<SingleItemSequence> lItemSeq(new SingleItemSequence(lDoc));
+    std::unique_ptr<SingleItemSequence> lItemSeq(new SingleItemSequence(lDoc));
     // Wrap in a CSequence to produce an XQC_Sequence. We pass "true"
     // to make CSequence assume memory-management responsibility for
     // the SingleItemSequence.
-    std::auto_ptr<CSequence> lSeq(new CSequence(lItemSeq.get(), true, NULL));
+    std::unique_ptr<CSequence> lSeq(new CSequence(lItemSeq.get(), true, NULL));
 
     lItemSeq.release();
     (*seq) = lSeq.release()->getXQC();
@@ -434,9 +433,9 @@
   {
     CIMPL_TRY {
       // Create a CrSeqData representing no data at all.
-      std::auto_ptr<CrSeqData> lData (new CrSeqData(0, XQC_DOUBLE_TYPE, false));
+      std::unique_ptr<CrSeqData> lData (new CrSeqData(0, XQC_DOUBLE_TYPE, false));
       lData->theDoubles = NULL;
-      me->create_sequence(lData, seq);
+      me->create_sequence(std::move(lData), seq);
     }
     CIMPL_CATCH;
   }
@@ -447,9 +446,9 @@
   {
     CIMPL_TRY {
       // Create a CrSeqData to hold the user's data.
-      std::auto_ptr<CrSeqData> lData(new CrSeqData(1, type, true));
+      std::unique_ptr<CrSeqData> lData(new CrSeqData(1, type, true));
       lData->theString = value;
-      me->create_sequence(lData, seq);
+      me->create_sequence(std::move(lData), seq);
     }
     CIMPL_CATCH;
   }
@@ -460,10 +459,10 @@
   {
     CIMPL_TRY {
       // Create a CrSeqData to hold the user's data.
-      std::auto_ptr<CrSeqData> lData
+      std::unique_ptr<CrSeqData> lData
         (new CrSeqData(count, XQC_STRING_TYPE, false));
       lData->theStrings = values;
-      me->create_sequence(lData, seq);
+      me->create_sequence(std::move(lData), seq);
     }
     CIMPL_CATCH;
   }
@@ -474,10 +473,10 @@
   {
     CIMPL_TRY {
       // Create a CrSeqData to hold the user's data.
-      std::auto_ptr<CrSeqData> lData
+      std::unique_ptr<CrSeqData> lData
         (new CrSeqData(count, XQC_DECIMAL_TYPE, false));
       lData->theInts = values;
-      me->create_sequence(lData, seq);
+      me->create_sequence(std::move(lData), seq);
     }
     CIMPL_CATCH;
   }
@@ -488,10 +487,10 @@
   {
     CIMPL_TRY {
       // Create a CrSeqData to hold the user's data.
-      std::auto_ptr<CrSeqData> lData
+      std::unique_ptr<CrSeqData> lData
         (new CrSeqData(count, XQC_DOUBLE_TYPE, false));
       lData->theDoubles = values;
-      me->create_sequence(lData, seq);
+      me->create_sequence(std::move(lData), seq);
     }
     CIMPL_CATCH;
   }

=== modified file 'src/capi/cimplementation.h'
--- src/capi/cimplementation.h	2013-08-05 11:24:53 +0000
+++ src/capi/cimplementation.h	2013-08-16 01:32:34 +0000
@@ -98,7 +98,7 @@
     private:
 
       void
-      create_sequence(std::auto_ptr<CrSeqData> data, XQC_Sequence** seq);
+      create_sequence(std::unique_ptr<CrSeqData> data, XQC_Sequence** seq);
 
       XQC_Error
       parse_istream(std::istream& aStream, XQC_Sequence** seq);

=== modified file 'src/capi/csequence.cpp'
--- src/capi/csequence.cpp	2013-07-01 18:59:06 +0000
+++ src/capi/csequence.cpp	2013-08-16 01:32:34 +0000
@@ -468,7 +468,7 @@
     if ( ! lItem.isNode() ) {
       return XQC_NOT_NODE;
     }
-    std::auto_ptr<Item> lNodeName(new Item());
+    std::unique_ptr<Item> lNodeName(new Item());
     if ( ! lItem.getNodeName(*lNodeName) ) {
       return XQC_INTERNAL_ERROR;
     }

=== modified file 'src/capi/cstatic_context.cpp'
--- src/capi/cstatic_context.cpp	2013-06-18 23:53:59 +0000
+++ src/capi/cstatic_context.cpp	2013-08-16 01:32:34 +0000
@@ -138,7 +138,7 @@
   {
     SC_TRY {
       StaticContext_t lChild = me->theContext.get()->createChildContext();
-      std::auto_ptr<CStaticContext> lCtx
+      std::unique_ptr<CStaticContext> lCtx
         (new CStaticContext(lChild, me->theZorba, me->theErrorHandler));
       (*child_context) = lCtx.release()->getXQC();
     }
@@ -646,7 +646,7 @@
         me->theContext.get()->registerModule(lModule);
       }
 
-      std::auto_ptr<CExternalFunction> lFunc
+      std::unique_ptr<CExternalFunction> lFunc
         (new CExternalFunction(uri, localname, init_fn, next_fn, free_fn,
           function_user_data, me->theZorba->getItemFactory(),
           me->theErrorHandler));

=== modified file 'src/capi/zorbac.cpp'
--- src/capi/zorbac.cpp	2013-02-07 17:24:36 +0000
+++ src/capi/zorbac.cpp	2013-08-16 01:32:34 +0000
@@ -32,7 +32,7 @@
     Zorba* lZorba =
       Zorba::getInstance(static_cast<zorba::store::Store*>(store));
 
-    std::auto_ptr<CImplementation> lImpl(new CImplementation(lZorba));
+    std::unique_ptr<CImplementation> lImpl(new CImplementation(lZorba));
 
     // Don't call anything that might throw an exception after this point
     (*impl) = lImpl.release()->getXQC();

=== modified file 'src/compiler/api/compiler_api.cpp'
--- src/compiler/api/compiler_api.cpp	2013-04-17 18:08:27 +0000
+++ src/compiler/api/compiler_api.cpp	2013-08-16 01:32:34 +0000
@@ -16,7 +16,6 @@
 #include "stdafx.h"
 
 #include <istream>
-#include <memory>
 
 #include "compiler/api/compiler_api.h"
 #include "diagnostics/xquery_diagnostics.h"
@@ -555,9 +554,9 @@
 }
 
 
-std::auto_ptr<XQueryCompilerSubsystem> XQueryCompilerSubsystem::create()
+std::unique_ptr<XQueryCompilerSubsystem> XQueryCompilerSubsystem::create()
 {
-  return std::auto_ptr<XQueryCompilerSubsystem>(new XQueryCompilerSubsystemImpl());
+  return std::unique_ptr<XQueryCompilerSubsystem>(new XQueryCompilerSubsystemImpl());
 }
 
 }

=== modified file 'src/compiler/api/compiler_api.h'
--- src/compiler/api/compiler_api.h	2013-04-10 10:13:31 +0000
+++ src/compiler/api/compiler_api.h	2013-08-16 01:32:34 +0000
@@ -17,7 +17,6 @@
 #ifndef ZORBA_COMPILER_API_H
 #define ZORBA_COMPILER_API_H
 
-#include <memory>
 #include "zorbatypes/schema_types.h"
 
 #include "common/shared_types.h"
@@ -98,7 +97,7 @@
   virtual Rewriter* getDefaultOptimizingRewriter() = 0;
 
 private:
-  static std::auto_ptr<XQueryCompilerSubsystem> create();
+  static std::unique_ptr<XQueryCompilerSubsystem> create();
 };
 
 

=== modified file 'src/compiler/api/compiler_api_impl.h'
--- src/compiler/api/compiler_api_impl.h	2013-02-07 17:24:36 +0000
+++ src/compiler/api/compiler_api_impl.h	2013-08-16 01:32:34 +0000
@@ -26,7 +26,7 @@
  friend class XQueryCompilerSubsystem;
 
 private:
-  std::auto_ptr<Rewriter> m_defaultOptimizer;
+  std::unique_ptr<Rewriter> m_defaultOptimizer;
 
 public:
   ~XQueryCompilerSubsystemImpl();

=== modified file 'src/compiler/codegen/plan_visitor.cpp'
--- src/compiler/codegen/plan_visitor.cpp	2013-07-01 18:59:06 +0000
+++ src/compiler/codegen/plan_visitor.cpp	2013-08-16 01:32:34 +0000
@@ -568,7 +568,7 @@
   CODEGEN_TRACE_OUT("");
   std::vector<PlanIter_t> argv;
   argv.push_back(pop_itstack());
-  std::auto_ptr<FunctionTraceIterator> lDummyIter(
+  std::unique_ptr<FunctionTraceIterator> lDummyIter(
       new FunctionTraceIterator(sctx, qloc, argv));
   lDummyIter->setFunctionName(v.getFunctionName());
   lDummyIter->setFunctionArity(v.getFunctionArity());
@@ -1635,8 +1635,8 @@
 
     PlanIter_t domainIter = pop_itstack();
 
-    std::auto_ptr<flwor::StartClause> start_clause;
-    std::auto_ptr<flwor::EndClause> end_clause;
+    std::unique_ptr<flwor::StartClause> start_clause;
+    std::unique_ptr<flwor::EndClause> end_clause;
     const flwor_wincond* cond;
     ulong varPos = 1;
 
@@ -1798,9 +1798,9 @@
 {
   flwor::FLWORIterator* flworIter;
   PlanIter_t returnIter;
-  std::auto_ptr<flwor::OrderByClause> orderClause(NULL);
-  std::auto_ptr<flwor::GroupByClause> groupClause(NULL);
-  std::auto_ptr<flwor::MaterializeClause> materializeClause(NULL);
+  std::unique_ptr<flwor::OrderByClause> orderClause(NULL);
+  std::unique_ptr<flwor::GroupByClause> groupClause(NULL);
+  std::unique_ptr<flwor::MaterializeClause> materializeClause(NULL);
   PlanIter_t whereIter;
   std::vector<flwor::ForLetClause> forletClauses;
 
@@ -2312,7 +2312,7 @@
   reverse(argvEvalIter.begin(), argvEvalIter.end());
 
   // get the debugger iterator from the debugger stack
-  std::auto_ptr<DebugIterator> lDebugIterator(theDebuggerStack.top());
+  std::unique_ptr<DebugIterator> lDebugIterator(theDebuggerStack.top());
   theDebuggerStack.pop();
 
   // set the children of the debugger iterator

=== modified file 'src/compiler/dewey/dewey.cpp'
--- src/compiler/dewey/dewey.cpp	2013-02-07 17:24:36 +0000
+++ src/compiler/dewey/dewey.cpp	2013-08-16 01:32:34 +0000
@@ -38,7 +38,7 @@
 {
   DeweyClassification lVisitor;
   aNode.accept(lVisitor);
-  auto_ptr<Node> lRoot(lVisitor.getRoot());
+  unique_ptr<Node> lRoot(lVisitor.getRoot());
   if(lRoot.get() != 0)
   {
     lRoot->accept(&lVisitor);

=== modified file 'src/compiler/expression/fo_expr.cpp'
--- src/compiler/expression/fo_expr.cpp	2013-06-27 15:54:27 +0000
+++ src/compiler/expression/fo_expr.cpp	2013-08-16 01:32:34 +0000
@@ -64,7 +64,7 @@
 {
   function* f = GENV_FUNC_LIB->getFunction(FunctionConsts::OP_CONCATENATE_N);
 
-  std::auto_ptr<fo_expr> fo(ccb->theEM->create_fo_expr(sctx, udf, loc, f));
+  std::unique_ptr<fo_expr> fo(ccb->theEM->create_fo_expr(sctx, udf, loc, f));
 
   return fo.release();
 }

=== modified file 'src/compiler/parser/jsoniq_parser.cpp'
--- src/compiler/parser/jsoniq_parser.cpp	2013-08-05 13:20:52 +0000
+++ src/compiler/parser/jsoniq_parser.cpp	2013-08-16 01:32:34 +0000
@@ -3941,7 +3941,7 @@
 /* Line 690 of lalr1.cc  */
 #line 1408 "/home/markos/zorba/repo/threads/build-nocc-g/src/compiler/parser/jsoniq_parser.y"
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(4) - (2)].varnametype)));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(4) - (2)].varnametype)));
       (yyval.node) = new GlobalVarDecl(LOC((yyloc)),
                              nt->theName,
                              nt->theType,
@@ -3957,7 +3957,7 @@
 /* Line 690 of lalr1.cc  */
 #line 1420 "/home/markos/zorba/repo/threads/build-nocc-g/src/compiler/parser/jsoniq_parser.y"
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(3) - (2)].varnametype)));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(3) - (2)].varnametype)));
       (yyval.node) = new GlobalVarDecl(LOC((yyloc)),
                              nt->theName,
                              nt->theType,
@@ -3973,7 +3973,7 @@
 /* Line 690 of lalr1.cc  */
 #line 1432 "/home/markos/zorba/repo/threads/build-nocc-g/src/compiler/parser/jsoniq_parser.y"
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(5) - (2)].varnametype)));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(5) - (2)].varnametype)));
       (yyval.node) = new GlobalVarDecl(LOC((yyloc)),
                              nt->theName,
                              nt->theType,

=== modified file 'src/compiler/parser/parser.y'
--- src/compiler/parser/parser.y	2013-06-17 20:05:21 +0000
+++ src/compiler/parser/parser.y	2013-08-16 01:32:34 +0000
@@ -1677,7 +1677,7 @@
 VarDecl :
     DECLARE VarNameAndType GETS ExprSingle
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>($2));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>($2));
 
       $$ = new GlobalVarDecl(LOC(@$),
                              nt->theName,
@@ -1691,7 +1691,7 @@
   |
     DECLARE VarNameAndType EXTERNAL
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>($2));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>($2));
 
       $$ = new GlobalVarDecl(LOC(@$),
                              nt->theName,
@@ -1705,7 +1705,7 @@
   |
     DECLARE VarNameAndType EXTERNAL GETS ExprSingle
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>($2));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>($2));
 
       $$ = new GlobalVarDecl(LOC(@$),
                              nt->theName,

=== modified file 'src/compiler/parser/xquery_parser.cpp'
--- src/compiler/parser/xquery_parser.cpp	2013-08-05 13:20:52 +0000
+++ src/compiler/parser/xquery_parser.cpp	2013-08-16 01:32:34 +0000
@@ -3914,7 +3914,7 @@
 /* Line 690 of lalr1.cc  */
 #line 1388 "/home/markos/zorba/repo/threads/build-nocc-g/src/compiler/parser/xquery_parser.y"
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(4) - (2)].varnametype)));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(4) - (2)].varnametype)));
       (yyval.node) = new GlobalVarDecl(LOC((yyloc)),
                              nt->theName,
                              nt->theType,
@@ -3930,7 +3930,7 @@
 /* Line 690 of lalr1.cc  */
 #line 1400 "/home/markos/zorba/repo/threads/build-nocc-g/src/compiler/parser/xquery_parser.y"
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(3) - (2)].varnametype)));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(3) - (2)].varnametype)));
       (yyval.node) = new GlobalVarDecl(LOC((yyloc)),
                              nt->theName,
                              nt->theType,
@@ -3946,7 +3946,7 @@
 /* Line 690 of lalr1.cc  */
 #line 1412 "/home/markos/zorba/repo/threads/build-nocc-g/src/compiler/parser/xquery_parser.y"
     {
-      std::auto_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(5) - (2)].varnametype)));
+      std::unique_ptr<VarNameAndType> nt(dynamic_cast<VarNameAndType *>((yysemantic_stack_[(5) - (2)].varnametype)));
       (yyval.node) = new GlobalVarDecl(LOC((yyloc)),
                              nt->theName,
                              nt->theType,

=== modified file 'src/compiler/rewriter/rules/flwor_rules.cpp'
--- src/compiler/rewriter/rules/flwor_rules.cpp	2013-08-09 10:23:10 +0000
+++ src/compiler/rewriter/rules/flwor_rules.cpp	2013-08-16 01:32:34 +0000
@@ -39,7 +39,6 @@
 
 #include "zorbatypes/integer.h"
 
-#include <memory>
 #include <iterator>
 
 namespace zorba

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2013-08-12 09:28:02 +0000
+++ src/compiler/translator/translator.cpp	2013-08-16 01:32:34 +0000
@@ -684,7 +684,7 @@
 
   std::stack<bool>                       theInWhileStack;
 
-  std::auto_ptr<AnnotationList>          theAnnotations;
+  std::unique_ptr<AnnotationList>          theAnnotations;
 
   IndexDecl_t                            theIndexDecl;
   bool                                   theIsInIndexDomain;
@@ -1647,7 +1647,7 @@
   inlineFuncExpr->add_variable(fiVar, fiSubstVar);
 
   // Create the inline udf obj.
-  std::auto_ptr<user_function> inlineUDF( 
+  std::unique_ptr<user_function> inlineUDF( 
   new user_function(loc,
                     signature(function_item_expr::create_inline_fname(loc),
                               funcType->get_param_types(),
@@ -1998,7 +1998,7 @@
 #ifdef ZORBA_WITH_DEBUGGER
   if (theCCB->theDebuggerCommons != NULL)
   {
-    std::auto_ptr<debugger_expr> lExpr(theExprManager->
+    std::unique_ptr<debugger_expr> lExpr(theExprManager->
     create_debugger_expr(theSctx,
                          theUDF,
                          aLoc,
@@ -2236,7 +2236,7 @@
 
   try
   {
-    std::auto_ptr<internal::Resource> lSchema;
+    std::unique_ptr<internal::Resource> lSchema;
     internal::StreamResource* lStream = NULL;
     zstring lErrorMessage;
 
@@ -3482,7 +3482,7 @@
       // rather than using compURI directly, because we want the version
       // fragment to be passed to the mappers.
       zstring errorMsg;
-      std::auto_ptr<internal::Resource> resource;
+      std::unique_ptr<internal::Resource> resource;
       internal::StreamResource* streamResource = NULL;
 
       try
@@ -12651,7 +12651,7 @@
     const QueryLoc& loc)
 {
   xqtref_t type;
-  std::auto_ptr<user_function> udf;
+  std::unique_ptr<user_function> udf;
   expr* body;
   
   function_item_expr* fiExpr =
@@ -13091,7 +13091,7 @@
   }
 
   // Create the udf obj.
-  std::auto_ptr<user_function> udf( 
+  std::unique_ptr<user_function> udf( 
   new user_function(loc,
                     signature(function_item_expr::create_inline_fname(loc),
                               paramTypes,
@@ -16116,7 +16116,7 @@
 #ifndef ZORBA_NO_FULL_TEXT
   zstring const &uri = v.get_uri();
   zstring error_msg;
-  std::auto_ptr<internal::Resource> rsrc(
+  std::unique_ptr<internal::Resource> rsrc(
     theSctx->resolve_uri( uri, internal::EntityData::THESAURUS, error_msg )
   );
   if ( !rsrc.get() )
@@ -16389,7 +16389,7 @@
     bool isLibModule,
     StaticContextConsts::xquery_version_t maxLibModuleVersion)
 {
-  std::auto_ptr<TranslatorImpl> t(new TranslatorImpl(rootTranslator,
+  std::unique_ptr<TranslatorImpl> t(new TranslatorImpl(rootTranslator,
                                                      rootSctx,
                                                      rootSctxId,
                                                      minfo,
@@ -16446,7 +16446,7 @@
   
   ModulesInfo minfo(ccb);
   
-  std::auto_ptr<TranslatorImpl> t(new TranslatorImpl(NULL,
+  std::unique_ptr<TranslatorImpl> t(new TranslatorImpl(NULL,
                                                      sctx,
                                                      ccb->theSctxMap.size(),
                                                      &minfo,

=== modified file 'src/context/default_uri_mappers.h'
--- src/context/default_uri_mappers.h	2013-02-07 17:24:36 +0000
+++ src/context/default_uri_mappers.h	2013-08-16 01:32:34 +0000
@@ -24,7 +24,6 @@
  * module-versioning and automatic filesystem URIMappers.
  */
 
-#include <memory>
 #include <istream>
 #include <zorbatypes/zstring.h>
 #include "context/uri_resolver.h"

=== modified file 'src/context/default_url_resolvers.cpp'
--- src/context/default_url_resolvers.cpp	2013-06-01 00:47:53 +0000
+++ src/context/default_url_resolvers.cpp	2013-08-16 01:32:34 +0000
@@ -86,7 +86,7 @@
     return nullptr;
   }
   try {
-    std::auto_ptr<HttpStream> lStream(new HttpStream(aUrl));
+    std::unique_ptr<HttpStream> lStream(new HttpStream(aUrl));
     lStream->init();
     // Take ownership of the istream and pass it to the StreamResource
     StreamResource* lResource =

=== modified file 'src/context/default_url_resolvers.h'
--- src/context/default_url_resolvers.h	2013-02-07 17:24:36 +0000
+++ src/context/default_url_resolvers.h	2013-08-16 01:32:34 +0000
@@ -24,7 +24,6 @@
  * module-versioning and automatic filesystem URIMappers.
  */
 
-#include <memory>
 #include <istream>
 #include <zorbatypes/zstring.h>
 #include "context/uri_resolver.h"

=== modified file 'src/context/dynamic_loader.cpp'
--- src/context/dynamic_loader.cpp	2013-06-14 23:46:26 +0000
+++ src/context/dynamic_loader.cpp	2013-08-16 01:32:34 +0000
@@ -221,7 +221,7 @@
   std::vector<zstring> lLibPath;
   aSctx.get_full_lib_path(lLibPath);
 
-  std::auto_ptr<std::istream> modfile(0); // result file
+  std::unique_ptr<std::istream> modfile(0); // result file
 
   if (lLibPath.size() != 0)
   {
@@ -256,7 +256,7 @@
       potentialModuleFile.append(lLibraryName);
       potentialModuleFileDebug.append(lLibraryNameDebug);
 
-      std::auto_ptr<std::istream> modfile
+      std::unique_ptr<std::istream> modfile
         (new std::ifstream(potentialModuleFile.c_str()));
 
       if (!modfile->good()) 

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2013-08-09 09:08:04 +0000
+++ src/context/static_context.cpp	2013-08-16 01:32:34 +0000
@@ -17,7 +17,6 @@
 
 #include <assert.h>
 #include <algorithm>
-#include <memory>
 
 #include <zorba/external_module.h>
 #include <zorba/serialization_callback.h>
@@ -834,6 +833,16 @@
 #if 0
   std::cout << "Deallocating SCTX : " << this << std::endl;
 #endif
+  for (std::vector<internal::URIMapper*>::const_iterator mapper =
+         theURIMappers.begin();
+       mapper != theURIMappers.end(); mapper++) {
+    delete *mapper;
+  }
+  for (std::vector<internal::URLResolver*>::const_iterator resolver =
+         theURLResolvers.begin();
+       resolver != theURLResolvers.end(); resolver++) {
+    delete *resolver;
+  }
 
   if (theExternalModulesMap)
   {
@@ -1588,7 +1597,7 @@
 ********************************************************************************/
 void static_context::add_uri_mapper(internal::URIMapper* aMapper)
 {
-  theURIMappers.push_back(std::auto_ptr<internal::URIMapper>(aMapper));
+  theURIMappers.push_back(aMapper);
 }
 
 
@@ -1597,14 +1606,14 @@
 ********************************************************************************/
 void static_context::add_url_resolver(internal::URLResolver* aResolver)
 {
-  theURLResolvers.push_back(std::auto_ptr<internal::URLResolver>(aResolver));
+  theURLResolvers.push_back(aResolver);
 }
 
 
 /***************************************************************************//**
 
 ********************************************************************************/
-std::auto_ptr<internal::Resource> static_context::resolve_uri(
+std::unique_ptr<internal::Resource> static_context::resolve_uri(
     zstring const& aUri,
     internal::EntityData::Kind aEntityKind,
     zstring& oErrorMessage) const
@@ -1614,7 +1623,7 @@
   return this->resolve_uri(aUri, lData, oErrorMessage);
 }
 
-std::auto_ptr<internal::Resource> static_context::resolve_uri(
+std::unique_ptr<internal::Resource> static_context::resolve_uri(
     zstring const& aUri,
     internal::EntityData const& aEntityData,
     zstring& oErrorMessage) const
@@ -1622,10 +1631,10 @@
   std::vector<zstring> lUris;
   apply_uri_mappers(aUri, &aEntityData, internal::URIMapper::CANDIDATE, lUris);
 
-  std::auto_ptr<internal::Resource> lRetval;
+  std::unique_ptr<internal::Resource> lRetval;
   apply_url_resolvers(lUris, &aEntityData, lRetval, oErrorMessage);
 
-  return lRetval;
+  return std::move(lRetval);
 }
 
 void static_context::get_component_uris(
@@ -1676,12 +1685,12 @@
        sctx != NULL; sctx = sctx->theParent)
   {
     // Iterate through all available mappers on this static_context...
-    for (ztd::auto_vector<internal::URIMapper>::const_iterator mapper =
+    for (std::vector<internal::URIMapper*>::const_iterator mapper =
            sctx->theURIMappers.begin();
          mapper != sctx->theURIMappers.end(); mapper++)
     {
       // Only call mappers of the appropriate kind
-      if ((*mapper)->mapperKind() != aMapperKind)
+      if ((**mapper).mapperKind() != aMapperKind)
       {
         continue;
       }
@@ -1747,7 +1756,7 @@
 void static_context::apply_url_resolvers(
     std::vector<zstring>& aUrls,
     internal::EntityData const* aEntityData,
-    std::auto_ptr<internal::Resource>& oResource,
+    std::unique_ptr<internal::Resource>& oResource,
     zstring& oErrorMessage) const
 {
   oErrorMessage.clear();
@@ -1771,14 +1780,14 @@
          sctx != NULL; sctx = sctx->theParent)
     {
       // Iterate through all available resolvers on this static_context...
-      for (ztd::auto_vector<internal::URLResolver>::const_iterator resolver =
+      for (std::vector<internal::URLResolver*>::const_iterator resolver =
              sctx->theURLResolvers.begin();
            resolver != sctx->theURLResolvers.end(); resolver++)
       {
         try
         {
           // Take ownership of returned Resource (if any)
-          oResource.reset((*resolver)->resolveURL(*url, aEntityData));
+          oResource.reset((**resolver).resolveURL(*url, aEntityData));
           if (oResource.get() != NULL)
           {
             // Populate the URL used to load this Resource

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2013-07-26 20:43:25 +0000
+++ src/context/static_context.h	2013-08-16 01:32:34 +0000
@@ -19,7 +19,6 @@
 
 #include <deque>
 #include <map>
-#include <memory>
 #include <set>
 #include <vector>
 
@@ -47,7 +46,6 @@
 #include "common/shared_types.h"
 
 #include "util/stl_util.h"
-#include "util/auto_vector.h"
 
 
 namespace zorba
@@ -591,9 +589,9 @@
 
   BaseUriInfo                           * theBaseUriInfo;
 
-  ztd::auto_vector<internal::URIMapper>   theURIMappers;
+  std::vector<internal::URIMapper*>       theURIMappers;
 
-  ztd::auto_vector<internal::URLResolver> theURLResolvers;
+  std::vector<internal::URLResolver*>     theURLResolvers;
 
   checked_vector<zstring>                 theURIPath;
 
@@ -775,7 +773,7 @@
    * Given a URI, return a Resource for that URI.
    * @param aEntityKind the expected kind of entity expected at this aUri
    */
-  std::auto_ptr<internal::Resource> resolve_uri(
+  std::unique_ptr<internal::Resource> resolve_uri(
       const zstring& aUri,
       internal::EntityData::Kind aEntityKind,
       zstring& oErrorMessage) const;
@@ -784,7 +782,7 @@
    * Given a URI, return a Resource for that URI.
    * @param aEntityData an EntityData object to pass to the mappers/resolvers.
    */
-  std::auto_ptr<internal::Resource> resolve_uri(
+  std::unique_ptr<internal::Resource> resolve_uri(
       const zstring& aUri,
       const internal::EntityData& aEntityData,
       zstring& oErrorMessage) const;
@@ -1170,7 +1168,7 @@
   void apply_url_resolvers(
       std::vector<zstring>& aUrls,
       internal::EntityData const* aEntityData,
-      std::auto_ptr<internal::Resource>& oResource,
+      std::unique_ptr<internal::Resource>& oResource,
       zstring& oErrorMessage) const;
 };
 

=== modified file 'src/context/uri_resolver.h'
--- src/context/uri_resolver.h	2013-06-11 23:38:49 +0000
+++ src/context/uri_resolver.h	2013-08-16 01:32:34 +0000
@@ -28,10 +28,8 @@
  * default_url_resolvers.h/cpp and default_uri_mappers.h/cpp.
  */
 
-#include <memory>
 #include <istream>
 #include <zorbatypes/zstring.h>
-#include <util/auto_vector.h>
 #include <store/api/shared_types.h>
 #include <zorba/streams.h>
 #include <zorba/util/locale.h>

=== modified file 'src/debugger/debugger_communicator.cpp'
--- src/debugger/debugger_communicator.cpp	2013-02-07 17:24:36 +0000
+++ src/debugger/debugger_communicator.cpp	2013-08-16 01:32:34 +0000
@@ -86,7 +86,7 @@
 	for (int i = 0; i < TIMEOUT && !theSocket; i++) {
 		try {
 			// Connect to the client on the given host and port
-      std::auto_ptr<TCPSocket> lSocket(new TCPSocket(theHost, thePort));
+      std::unique_ptr<TCPSocket> lSocket(new TCPSocket(theHost, thePort));
       theSocket = lSocket.release();
       theSocketInStream = new SocketStreambuf(*theSocket);
       theSocketOutStream = new SocketStreambuf(*theSocket);

=== modified file 'src/debugger/debugger_event_listener.cpp'
--- src/debugger/debugger_event_listener.cpp	2013-02-07 17:24:36 +0000
+++ src/debugger/debugger_event_listener.cpp	2013-08-16 01:32:34 +0000
@@ -16,8 +16,6 @@
 
 #include "debugger_event_listener.h"
 
-#include <memory>
-
 #include "api/unmarshaller.h"
 
 #include "debugger/socket.h"
@@ -51,7 +49,7 @@
   try {
     theSocket = theClient->theEventServerSocket->accept();
     while (theClient->getExecutionStatus() != QUERY_TERMINATED) {
-      std::auto_ptr<AbstractMessage> lMessage(MessageFactory::buildMessage(theSocket));
+      std::unique_ptr<AbstractMessage> lMessage(MessageFactory::buildMessage(theSocket));
       SuspendedEvent* lSuspendedMsg;
       EvaluatedEvent* lEvaluatedEvent;
       if ((lSuspendedMsg = dynamic_cast<SuspendedEvent*> (lMessage.get()))) {

=== modified file 'src/debugger/debugger_runtime.cpp'
--- src/debugger/debugger_runtime.cpp	2013-02-07 17:24:36 +0000
+++ src/debugger/debugger_runtime.cpp	2013-08-16 01:32:34 +0000
@@ -18,7 +18,6 @@
 
 #include "debugger_runtime.h"
 
-#include <memory>
 #include <vector>
 #include <sstream>
 #include <iomanip>

=== modified file 'src/functions/library.cpp'
--- src/functions/library.cpp	2013-07-02 21:32:23 +0000
+++ src/functions/library.cpp	2013-08-16 01:32:34 +0000
@@ -16,7 +16,6 @@
 #include "stdafx.h"
 
 #include <iostream>
-#include <memory>
 
 #include "zorbamisc/ns_consts.h"
 

=== modified file 'src/precompiled/stdafx.h'
--- src/precompiled/stdafx.h	2013-06-12 00:21:05 +0000
+++ src/precompiled/stdafx.h	2013-08-16 01:32:34 +0000
@@ -21,7 +21,6 @@
   #include <stdexcept>
   #include <cassert>
   #include <cstring>
-  #include <memory>
 
   #include <sstream>
   #include <istream>

=== modified file 'src/runtime/collections/collections_impl.cpp'
--- src/runtime/collections/collections_impl.cpp	2013-07-25 14:09:47 +0000
+++ src/runtime/collections/collections_impl.cpp	2013-08-16 01:32:34 +0000
@@ -178,7 +178,7 @@
 {
   store::Item_t uriItem;
   store::Collection_t coll;
-  std::auto_ptr<internal::Resource> resource;
+  std::unique_ptr<internal::Resource> resource;
   internal::CollectionResource* collResource;
   zstring resolvedURI;
   zstring errorMessage;
@@ -489,7 +489,7 @@
   const StaticallyKnownCollection* collectionDecl;
   store::Item_t node;
   store::Item_t copyNode;
-  std::auto_ptr<store::PUL> pul;
+  std::unique_ptr<store::PUL> pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
@@ -605,7 +605,7 @@
 {
   store::Item_t name;
   store::Collection_t collection;
-  std::auto_ptr<store::PUL> pul;
+  std::unique_ptr<store::PUL> pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
@@ -636,7 +636,7 @@
     PlanState& planState) const
 {
   std::vector<store::Item_t>       nodes;
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
   store::Item_t                    name;
 
   PlanIteratorState* state;
@@ -708,7 +708,7 @@
     PlanState& planState) const
 {
   std::vector<store::Item_t> nodes;
-  std::auto_ptr<store::PUL> pul;
+  std::unique_ptr<store::PUL> pul;
   store::Item_t name;
 
   PlanIteratorState* state;
@@ -794,7 +794,7 @@
     PlanState& planState) const
 {
   std::vector<store::Item_t>       nodes;
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
   store::Item_t                    name;
 
   PlanIteratorState* state;
@@ -873,7 +873,7 @@
   store::Item_t                    targetNode;
   store::Item_t                    node;
   std::vector<store::Item_t>       nodes;
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -959,7 +959,7 @@
 {
   store::Item_t               name;
   std::vector<store::Item_t>  nodes;
-  std::auto_ptr<store::PUL>   pul;
+  std::unique_ptr<store::PUL>   pul;
   store::Item_t               targetNode;
 
   store::CopyMode lCopyMode;
@@ -1061,7 +1061,7 @@
     store::Item_t& result,
     PlanState& planState) const
 {
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
   std::vector<store::Item_t>       nodes;
   store::Item_t                    name;
 
@@ -1146,7 +1146,7 @@
     store::Item_t& result,
     PlanState& planState) const
 {
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
   std::vector<store::Item_t>       nodes;
   store::Item_t                    name;
 
@@ -1230,7 +1230,7 @@
     store::Item_t& result,
     PlanState& planState) const
 {
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
   std::vector<store::Item_t>       nodes;
   store::Item_t                    name;
 
@@ -1314,7 +1314,7 @@
     store::Item_t& result,
     PlanState& planState) const
 {
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
   std::vector<store::Item_t>       nodes;
   store::Item_t                    name;
   store::Item_t                    targetNode;
@@ -1403,7 +1403,7 @@
     store::Item_t& result,
     PlanState& planState) const
 {
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
   std::vector<store::Item_t>       nodes;
   store::Item_t                    name;
   store::Item_t                    targetNode;
@@ -1479,7 +1479,7 @@
   store::Item_t                    name;
   store::Item_t                    node;
   std::vector<store::Item_t>       nodes;
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -1583,7 +1583,7 @@
   store::Item_t                    numNodesItem;
   xs_integer                       numNodes( 1 );
   std::vector<store::Item_t>       nodes;
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -1674,7 +1674,7 @@
   store::Item_t                    numNodesItem;
   xs_integer                       numNodes( 1 );
   std::vector<store::Item_t>       nodes;
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -1774,7 +1774,7 @@
   store::Item_t                    content;
   store::CopyMode lCopyMode;
 
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -1890,7 +1890,7 @@
 {
   store::Collection_t              collection;
   store::Item_t                    collectionName;
-  std::auto_ptr<store::PUL>        pul;
+  std::unique_ptr<store::PUL>        pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -2514,7 +2514,7 @@
 {
   store::Item_t lURI, resolvedURIItem, lIte;
   store::Collection_t coll;
-  std::auto_ptr<internal::Resource> lResource;
+  std::unique_ptr<internal::Resource> lResource;
   internal::CollectionResource* lCollResource;
   zstring resolvedURIString;
   zstring lErrorMessage;

=== modified file 'src/runtime/context/context_impl.cpp'
--- src/runtime/context/context_impl.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/context/context_impl.cpp	2013-08-16 01:32:34 +0000
@@ -15,8 +15,6 @@
  */
 #include "stdafx.h"
 
-#include <memory>
-
 #include "system/globalenv.h"
 
 #include "compiler/api/compilercb.h"
@@ -53,7 +51,7 @@
 CurrentDateIterator::nextImpl(store::Item_t& result, PlanState& planState) const
 {
   store::Item_t itemRes;
-  std::auto_ptr<xs_date> d;
+  std::unique_ptr<xs_date> d;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -73,7 +71,7 @@
 CurrentTimeIterator::nextImpl(store::Item_t& result, PlanState& planState) const
 {
   store::Item_t itemRes;
-  std::auto_ptr<xs_time> t;
+  std::unique_ptr<xs_time> t;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -94,7 +92,7 @@
   long secs;
   bool neg;
   xs_dayTimeDuration dtd;
-  std::auto_ptr<Duration> dur;
+  std::unique_ptr<Duration> dur;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -103,7 +101,7 @@
   neg = secs < 0;
   if (neg)
     secs = -secs;
-  dur = std::auto_ptr<Duration>(new Duration(Duration::DAYTIMEDURATION_FACET, neg, 0, 0, 0, 0, 0 , secs));
+  dur = std::unique_ptr<Duration>(new Duration(Duration::DAYTIMEDURATION_FACET, neg, 0, 0, 0, 0, 0 , secs));
 
   STACK_PUSH( GENV_ITEMFACTORY->createDayTimeDuration(result, dur.get()), state );
 

=== modified file 'src/runtime/core/arithmetic_impl.cpp'
--- src/runtime/core/arithmetic_impl.cpp	2013-06-11 05:40:04 +0000
+++ src/runtime/core/arithmetic_impl.cpp	2013-08-16 01:32:34 +0000
@@ -342,7 +342,7 @@
    const store::Item* i0,
    const store::Item* i1 )
 {
-  std::auto_ptr<Duration> d(i0->getYearMonthDurationValue() + i1->getYearMonthDurationValue());
+  std::unique_ptr<Duration> d(i0->getYearMonthDurationValue() + i1->getYearMonthDurationValue());
   return GENV_ITEMFACTORY->createYearMonthDuration(result, d.get());
 }
 
@@ -356,7 +356,7 @@
   const store::Item* i0,
   const store::Item* i1 )
 {
-  std::auto_ptr<Duration> d(i0->getDayTimeDurationValue() + i1->getDayTimeDurationValue());
+  std::unique_ptr<Duration> d(i0->getDayTimeDurationValue() + i1->getDayTimeDurationValue());
   return GENV_ITEMFACTORY->createDayTimeDuration(result, d.get());
 }
 
@@ -370,7 +370,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<xs_dateTime> d(i0->getDateTimeValue().addDuration(i1->getDurationValue()));
+  std::unique_ptr<xs_dateTime> d(i0->getDateTimeValue().addDuration(i1->getDurationValue()));
   return GENV_ITEMFACTORY->createDateTime(result, d.get());
 }
 
@@ -384,7 +384,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<xs_dateTime> d(i1->getDateTimeValue().addDuration(i0->getDurationValue()));
+  std::unique_ptr<xs_dateTime> d(i1->getDateTimeValue().addDuration(i0->getDurationValue()));
   return GENV_ITEMFACTORY->createDateTime(result, d.get());
 }
 
@@ -398,7 +398,7 @@
   const store::Item* i0,
   const store::Item* i1)
 {
-  std::auto_ptr<xs_date> d(i0->getDateValue().addDuration(i1->getDurationValue()));
+  std::unique_ptr<xs_date> d(i0->getDateValue().addDuration(i1->getDurationValue()));
   return GENV_ITEMFACTORY->createDate(result, d.get());
 }
 
@@ -412,7 +412,7 @@
   const store::Item* i0,
   const store::Item* i1 )
 {
-  std::auto_ptr<xs_date> d(i1->getDateValue().addDuration(i0->getDurationValue()));
+  std::unique_ptr<xs_date> d(i1->getDateValue().addDuration(i0->getDurationValue()));
   return GENV_ITEMFACTORY->createDate (result, d.get());
 }
 
@@ -426,7 +426,7 @@
   const store::Item* i0,
   const store::Item* i1 )
 {
-  std::auto_ptr<xs_time> t(i0->getTimeValue().addDuration(i1->getDurationValue()));
+  std::unique_ptr<xs_time> t(i0->getTimeValue().addDuration(i1->getDurationValue()));
   return GENV_ITEMFACTORY->createTime (result, t.get());
 }
 
@@ -440,7 +440,7 @@
   const store::Item* i0,
   const store::Item* i1 )
 {
-  std::auto_ptr<xs_time> t(i1->getTimeValue().addDuration(i0->getDurationValue()));
+  std::unique_ptr<xs_time> t(i1->getTimeValue().addDuration(i0->getDurationValue()));
   return GENV_ITEMFACTORY->createTime (result, t.get());
 }
 
@@ -458,7 +458,7 @@
     const store::Item* i0,
     const store::Item* i1 )
 {
-  std::auto_ptr<Duration> d(i0->getYearMonthDurationValue() -
+  std::unique_ptr<Duration> d(i0->getYearMonthDurationValue() -
                             i1->getYearMonthDurationValue());
 
   return GENV_ITEMFACTORY->createYearMonthDuration(result, d.get());
@@ -474,7 +474,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<Duration> d(i0->getDayTimeDurationValue() -
+  std::unique_ptr<Duration> d(i0->getDayTimeDurationValue() -
                             i1->getDayTimeDurationValue());
 
   return GENV_ITEMFACTORY->createDayTimeDuration(result, d.get());
@@ -490,7 +490,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<xs_dateTime> d(i0->getDateTimeValue().subtractDuration(i1->getDurationValue()));
+  std::unique_ptr<xs_dateTime> d(i0->getDateTimeValue().subtractDuration(i1->getDurationValue()));
   return GENV_ITEMFACTORY->createDateTime(result, d.get());
 }
 
@@ -504,7 +504,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<xs_date> d(i0->getDateValue().subtractDuration(i1->getDurationValue()));
+  std::unique_ptr<xs_date> d(i0->getDateValue().subtractDuration(i1->getDurationValue()));
   return GENV_ITEMFACTORY->createDate(result, d.get());
 }
 
@@ -518,7 +518,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<xs_time> t(i0->getTimeValue().subtractDuration(i1->getDurationValue()));
+  std::unique_ptr<xs_time> t(i0->getTimeValue().subtractDuration(i1->getDurationValue()));
   return GENV_ITEMFACTORY->createTime(result, t.get());
 }
 
@@ -532,7 +532,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<Duration> d;
+  std::unique_ptr<Duration> d;
   try 
   {
     d.reset(i0->getDateTimeValue().subtractDateTime(&i1->getDateTimeValue(),
@@ -555,7 +555,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<Duration> d;
+  std::unique_ptr<Duration> d;
   try 
   {
     d.reset(i0->getTimeValue().subtractDateTime(&i1->getTimeValue(),
@@ -578,7 +578,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<Duration> d;
+  std::unique_ptr<Duration> d;
   try 
   {
     d.reset(i0->getTimeValue().subtractDateTime(&i1->getTimeValue(),
@@ -605,7 +605,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<Duration> d;
+  std::unique_ptr<Duration> d;
   
   if ( i1->getDoubleValue().isPosInf() || i1->getDoubleValue().isNegInf() )
     throw XQUERY_EXCEPTION( err::FODT0002, ERROR_LOC( loc ) );
@@ -631,7 +631,7 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<Duration> d;
+  std::unique_ptr<Duration> d;
   
   if ( i1->getDoubleValue().isPosInf() || i1->getDoubleValue().isNegInf() )
     throw XQUERY_EXCEPTION( err::FODT0002, ERROR_LOC( loc ) );
@@ -687,18 +687,18 @@
     const store::Item* i0,
     const store::Item* i1)
 {
-  std::auto_ptr<Duration> d;
+  std::unique_ptr<Duration> d;
 
   if( i1->getDoubleValue().isPosInf() || i1->getDoubleValue().isNegInf() )
   {
-    d = std::auto_ptr<Duration>(new Duration(Duration::YEARMONTHDURATION_FACET));
+    d = std::unique_ptr<Duration>(new Duration(Duration::YEARMONTHDURATION_FACET));
   }
   else if ( i1->getDoubleValue().isZero() )
     throw XQUERY_EXCEPTION( err::FODT0002, ERROR_LOC( loc ) );
   else if ( i1->getDoubleValue().isNaN() )
     throw XQUERY_EXCEPTION( err::FOCA0005, ERROR_LOC( loc ) );
   else try {
-    d = std::auto_ptr<Duration>(i0->getYearMonthDurationValue() / i1->getDoubleValue());
+    d = std::unique_ptr<Duration>(i0->getYearMonthDurationValue() / i1->getDoubleValue());
   } catch (XQueryException& e) {
     set_source(e, *loc);
     throw;
@@ -717,7 +717,7 @@
   const store::Item* i0,
   const store::Item* i1 )
 {
-  std::auto_ptr<Duration> d;
+  std::unique_ptr<Duration> d;
 
   if( i1->getDoubleValue().isPosInf() || i1->getDoubleValue().isNegInf() )
   {

=== modified file 'src/runtime/core/flwor_iterator.cpp'
--- src/runtime/core/flwor_iterator.cpp	2013-05-28 18:20:54 +0000
+++ src/runtime/core/flwor_iterator.cpp	2013-08-16 01:32:34 +0000
@@ -1482,7 +1482,7 @@
 {
   ZORBA_ASSERT(theGroupByClause);
 
-  std::auto_ptr<GroupTuple> groupTuple(new GroupTuple());
+  std::unique_ptr<GroupTuple> groupTuple(new GroupTuple());
   std::vector<store::Item_t>& groupTupleItems = groupTuple->theItems;
 
   std::vector<GroupingSpec> groupSpecs = theGroupByClause->theGroupingSpecs;

=== modified file 'src/runtime/core/gflwor/groupby_iterator.cpp'
--- src/runtime/core/gflwor/groupby_iterator.cpp	2013-05-28 18:20:54 +0000
+++ src/runtime/core/gflwor/groupby_iterator.cpp	2013-08-16 01:32:34 +0000
@@ -356,7 +356,7 @@
 {
   store::Item_t temp;
 
-  std::auto_ptr<GroupTuple> groupTuple(new GroupTuple());
+  std::unique_ptr<GroupTuple> groupTuple(new GroupTuple());
   std::vector<store::Item_t>& groupTupleItems = groupTuple->theItems;
 
   csize numVars = theGroupingSpecs.size();

=== modified file 'src/runtime/core/gflwor/tuplestream_iterator.cpp'
--- src/runtime/core/gflwor/tuplestream_iterator.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/core/gflwor/tuplestream_iterator.cpp	2013-08-16 01:32:34 +0000
@@ -60,7 +60,7 @@
 //theChild1 == ReturnClause
 bool TupleStreamIterator::nextImpl(store::Item_t& aResult, PlanState& aPlanState) const 
 {
-  std::auto_ptr<store::PUL> pul;
+  std::unique_ptr<store::PUL> pul;
   store::Item_t lTuple;
 
   PlanIteratorState* lState;

=== modified file 'src/runtime/durations_dates_times/DurationsDatesTimesImpl.cpp'
--- src/runtime/durations_dates_times/DurationsDatesTimesImpl.cpp	2013-03-26 20:23:10 +0000
+++ src/runtime/durations_dates_times/DurationsDatesTimesImpl.cpp	2013-08-16 01:32:34 +0000
@@ -97,7 +97,7 @@
 {
   store::Item_t item0;
   store::Item_t item1;
-  std::auto_ptr<DateTime> dt;
+  std::unique_ptr<DateTime> dt;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -111,7 +111,7 @@
   {
     try
     {
-      dt = std::auto_ptr<DateTime>(item0->getDateTimeValue().adjustToTimeZone(
+      dt = std::unique_ptr<DateTime>(item0->getDateTimeValue().adjustToTimeZone(
         planState.theLocalDynCtx->get_implicit_timezone()));
     }
     catch (InvalidTimezoneException const &e)
@@ -147,7 +147,7 @@
   store::Item_t item0;
   store::Item_t item1;
   bool s1;
-  std::auto_ptr<DateTime> dt;
+  std::unique_ptr<DateTime> dt;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
@@ -161,7 +161,7 @@
     s1 = consumeNext(item1, theChild1.getp(), planState);
     try
     {
-      dt = std::auto_ptr<DateTime>(item0->getDateTimeValue().adjustToTimeZone(!s1 ? NULL : &item1->getDayTimeDurationValue()));
+      dt = std::unique_ptr<DateTime>(item0->getDateTimeValue().adjustToTimeZone(!s1 ? NULL : &item1->getDayTimeDurationValue()));
     }
     catch (InvalidTimezoneException const &e)
     {

=== modified file 'src/runtime/eval/eval.h'
--- src/runtime/eval/eval.h	2013-07-26 12:45:00 +0000
+++ src/runtime/eval/eval.h	2013-08-16 01:32:34 +0000
@@ -31,8 +31,8 @@
 public:
   PlanIter_t                     thePlan;
   PlanWrapper_t                  thePlanWrapper;
-  std::auto_ptr<CompilerCB>      ccb;
-  std::auto_ptr<dynamic_context> dctx;
+  std::unique_ptr<CompilerCB>      ccb;
+  std::unique_ptr<dynamic_context> dctx;
 
 public:
   EvalIteratorState();

=== modified file 'src/runtime/fetch/fetch_impl.cpp'
--- src/runtime/fetch/fetch_impl.cpp	2013-06-11 23:38:49 +0000
+++ src/runtime/fetch/fetch_impl.cpp	2013-08-16 01:32:34 +0000
@@ -32,7 +32,7 @@
 
 /*******************************************************************************
 ********************************************************************************/
-std::auto_ptr<internal::StreamResource>
+std::unique_ptr<internal::StreamResource>
 getFetchResource(
     const store::Item_t& aUri,
     const store::Item_t& aKind,
@@ -72,12 +72,12 @@
     // me a resource of specified kind
     zstring lErrorMessage;
     
-    std::auto_ptr<internal::Resource> lRes = aSctx->resolve_uri(
+    std::unique_ptr<internal::Resource> lRes = aSctx->resolve_uri(
       aUri->getStringValue(),
       lKind,
       lErrorMessage);
 
-    std::auto_ptr<internal::StreamResource> lStreamRes(
+    std::unique_ptr<internal::StreamResource> lStreamRes(
       dynamic_cast<internal::StreamResource*>(lRes.get()));
 
     if ( !lStreamRes.get() )
@@ -94,7 +94,7 @@
 
     lRes.release();
 
-    return lStreamRes;
+    return std::move(lStreamRes);
 
   } catch (ZorbaException const& e) {
     throw XQUERY_EXCEPTION(
@@ -122,7 +122,7 @@
   store::Item_t lEntityKind;
   store::Item_t lEncoding;
   zstring lEncodingStr;
-  std::auto_ptr<internal::StreamResource> lRes;
+  std::unique_ptr<internal::StreamResource> lRes;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
@@ -180,7 +180,7 @@
 {
   store::Item_t lUri;
   store::Item_t lEntityKind;
-  std::auto_ptr<internal::StreamResource> lRes;
+  std::unique_ptr<internal::StreamResource> lRes;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);

=== modified file 'src/runtime/fnput/fnput_impl.cpp'
--- src/runtime/fnput/fnput_impl.cpp	2013-02-07 17:24:36 +0000
+++ src/runtime/fnput/fnput_impl.cpp	2013-08-16 01:32:34 +0000
@@ -43,7 +43,7 @@
   zstring resolvedUriString;
   URI lTargetUri;
   store::Item_t resolvedUriItem;
-  std::auto_ptr<store::PUL> pul;
+  std::unique_ptr<store::PUL> pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);

=== modified file 'src/runtime/full_text/apply.cpp'
--- src/runtime/full_text/apply.cpp	2013-08-07 01:18:50 +0000
+++ src/runtime/full_text/apply.cpp	2013-08-16 01:32:34 +0000
@@ -1224,7 +1224,7 @@
   zstring const &uri = t_id.get_uri();
 
   zstring error_msg;
-  auto_ptr<internal::Resource> rsrc = static_ctx_.resolve_uri(
+  unique_ptr<internal::Resource> rsrc = static_ctx_.resolve_uri(
     uri, internal::EntityData::THESAURUS, error_msg
   );
   ZORBA_ASSERT( rsrc.get() );

=== modified file 'src/runtime/full_text/ft_module_impl.cpp'
--- src/runtime/full_text/ft_module_impl.cpp	2013-08-02 18:33:17 +0000
+++ src/runtime/full_text/ft_module_impl.cpp	2013-08-16 01:32:34 +0000
@@ -368,7 +368,7 @@
     static_context const *const sctx = getStaticContext();
     ZORBA_ASSERT( sctx );
     zstring error_msg;
-    auto_ptr<internal::Resource> rsrc = sctx->resolve_uri(
+    unique_ptr<internal::Resource> rsrc = sctx->resolve_uri(
       uri, internal::EntityData::THESAURUS, error_msg
     );
     if ( !rsrc.get() )
@@ -503,7 +503,7 @@
   zstring error_msg;
   store::Item_t item;
   iso639_1::type lang;
-  auto_ptr<internal::Resource> rsrc;
+  unique_ptr<internal::Resource> rsrc;
   zstring uri = "##default";
   static_context const *sctx;
   zstring synonym;

=== modified file 'src/runtime/full_text/ft_stop_words_set.cpp'
--- src/runtime/full_text/ft_stop_words_set.cpp	2013-08-02 18:33:02 +0000
+++ src/runtime/full_text/ft_stop_words_set.cpp	2013-08-16 01:32:34 +0000
@@ -126,7 +126,7 @@
       }
 
       zstring error_msg;
-      std::auto_ptr<internal::Resource> rsrc =
+      std::unique_ptr<internal::Resource> rsrc =
         sctx.resolve_uri( uri, internal::EntityData::STOP_WORDS, error_msg );
       internal::StreamResource *const stream_rsrc =
         dynamic_cast<internal::StreamResource*>( rsrc.get() );

=== modified file 'src/runtime/full_text/ftcontains_visitor.cpp'
--- src/runtime/full_text/ftcontains_visitor.cpp	2013-06-01 00:30:39 +0000
+++ src/runtime/full_text/ftcontains_visitor.cpp	2013-08-16 01:32:34 +0000
@@ -17,7 +17,6 @@
 
 #include <cmath>                        /* for fabs(3) */
 #include <limits>
-#include <memory>
 
 #include <zorba/internal/cxx_util.h>
 

=== modified file 'src/runtime/hof/fn_hof_functions_impl.cpp'
--- src/runtime/hof/fn_hof_functions_impl.cpp	2013-07-02 21:32:23 +0000
+++ src/runtime/hof/fn_hof_functions_impl.cpp	2013-08-16 01:32:34 +0000
@@ -111,7 +111,7 @@
     static_context_t impSctx = theSctx->create_child_context();
     ccb->theSctxMap[ccb->theSctxMap.size() + 1] = impSctx;
 
-    std::auto_ptr<dynamic_context> fiDctx;
+    std::unique_ptr<dynamic_context> fiDctx;
     fiDctx.reset(new dynamic_context(planState.theGlobalDynCtx));
 
     if (ctxItem)

=== modified file 'src/runtime/hof/function_item.cpp'
--- src/runtime/hof/function_item.cpp	2013-07-02 21:32:23 +0000
+++ src/runtime/hof/function_item.cpp	2013-08-16 01:32:34 +0000
@@ -16,7 +16,7 @@
 #include "stdafx.h"
 
 // This include needs to be kept in order to make sure the
-// auto_ptr<dynamic_context> manages to dealocate the
+// unique_ptr<dynamic_context> manages to dealocate the
 // dynamic_context object.
 #include "context/dynamic_context.h"
 

=== modified file 'src/runtime/hof/function_item.h'
--- src/runtime/hof/function_item.h	2013-07-02 21:32:23 +0000
+++ src/runtime/hof/function_item.h	2013-08-16 01:32:34 +0000
@@ -184,7 +184,7 @@
 
   csize                           theArity;
 
-  std::auto_ptr<dynamic_context>  theClosureDctx;
+  std::unique_ptr<dynamic_context>  theClosureDctx;
 
   std::vector<PlanIter_t>         theArgValues;
 

=== modified file 'src/runtime/hof/function_item_iter.cpp'
--- src/runtime/hof/function_item_iter.cpp	2013-04-24 01:35:58 +0000
+++ src/runtime/hof/function_item_iter.cpp	2013-08-16 01:32:34 +0000
@@ -16,7 +16,7 @@
 #include "stdafx.h"
 
 // This include needs to be kept in order to make sure the
-// auto_ptr<dynamic_context> manages to dealocate the
+// unique_ptr<dynamic_context> manages to dealocate the
 // dynamic_context object.
 #include "context/dynamic_context.h"
 
@@ -74,7 +74,7 @@
 
   if (numOuterVars > 0)
   {
-    std::auto_ptr<dynamic_context> evalDctx;
+    std::unique_ptr<dynamic_context> evalDctx;
     evalDctx.reset(new dynamic_context(planState.theGlobalDynCtx));
 
     for (csize i = 0; i < numOuterVars; ++i)

=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
--- src/runtime/json/jsoniq_functions_impl.cpp	2013-08-14 15:16:42 +0000
+++ src/runtime/json/jsoniq_functions_impl.cpp	2013-08-16 01:32:34 +0000
@@ -648,7 +648,7 @@
     }
 
     // and now serialize
-    std::auto_ptr<std::stringstream> lResultStream(new std::stringstream());
+    std::unique_ptr<std::stringstream> lResultStream(new std::stringstream());
     lItemIt->open();
     lSerializer.serialize(lItemIt, *lResultStream.get());
     lItemIt->close();

=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.h'
--- src/runtime/json/pregenerated/jsoniq_functions.h	2013-08-14 15:16:42 +0000
+++ src/runtime/json/pregenerated/jsoniq_functions.h	2013-08-16 01:32:34 +0000
@@ -192,6 +192,55 @@
 
 
 /**
+<<<<<<< TREE
+=======
+ * jn:json-doc
+ * Author: Zorba Team
+ */
+class JSONDocIteratorState : public PlanIteratorState
+{
+public:
+  std::unique_ptr<internal::Resource> theResource; //
+  std::istream* theStream; //
+  bool theGotOne; //
+  json::loader* loader_; //
+
+  JSONDocIteratorState();
+
+  ~JSONDocIteratorState();
+
+  void init(PlanState&);
+  void reset(PlanState&);
+};
+
+class JSONDocIterator : public NaryBaseIterator<JSONDocIterator, JSONDocIteratorState>
+{ 
+public:
+  SERIALIZABLE_CLASS(JSONDocIterator);
+
+  SERIALIZABLE_CLASS_CONSTRUCTOR2T(JSONDocIterator,
+    NaryBaseIterator<JSONDocIterator, JSONDocIteratorState>);
+
+  void serialize( ::zorba::serialization::Archiver& ar);
+
+  JSONDocIterator(
+    static_context* sctx,
+    const QueryLoc& loc,
+    std::vector<PlanIter_t>& children)
+    : 
+    NaryBaseIterator<JSONDocIterator, JSONDocIteratorState>(sctx, loc, children)
+  {}
+
+  virtual ~JSONDocIterator();
+
+  void accept(PlanIterVisitor& v) const;
+
+  bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
+};
+
+
+/**
+>>>>>>> MERGE-SOURCE
  * 
  * Author: 
  */

=== modified file 'src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp'
--- src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp	2013-07-25 14:10:17 +0000
+++ src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp	2013-08-16 01:32:34 +0000
@@ -52,7 +52,7 @@
   zstring baseUri;
   URI lValidatedBaseUri;
   zstring docUri;
-  std::auto_ptr<std::istringstream> iss;
+  std::unique_ptr<std::istringstream> iss;
   std::istream* is;
 
   PlanIteratorState* state;
@@ -63,11 +63,11 @@
 
     if (result->isStreamable())
     {
-      // The "iss" auto_ptr can NOT be used since it will delete the stream that,
+      // The "iss" unique_ptr can NOT be used since it will delete the stream that,
       // in this case, is a data member inside another object and not dynamically
       // allocated.
       //
-      // We can't replace "iss" with "is" since we still need the auto_ptr for
+      // We can't replace "iss" with "is" since we still need the unique_ptr for
       // the case when the result is not streamable.
       is = &result->getStream();
     }
@@ -249,7 +249,7 @@
 
     {
       // and now serialize
-      std::auto_ptr<std::stringstream> lResultStream(new std::stringstream());
+      std::unique_ptr<std::stringstream> lResultStream(new std::stringstream());
       lSerializer.serialize(lIterWrapper, *lResultStream.get());
       GENV_ITEMFACTORY->createStreamableString(aResult, *lResultStream.release(), FnSerializeIterator::streamReleaser, true);
     }

=== modified file 'src/runtime/sequences/SequencesImpl.h'
--- src/runtime/sequences/SequencesImpl.h	2013-02-07 17:24:36 +0000
+++ src/runtime/sequences/SequencesImpl.h	2013-08-16 01:32:34 +0000
@@ -17,7 +17,6 @@
 #ifndef ZORBA_SEQUENCES_IMPL_H
 #define ZORBA_SEQUENCES_IMPL_H
 
-#include <memory>
 #include <vector>
 #include <stack>
 

=== modified file 'src/runtime/sequences/pregenerated/sequences.h'
--- src/runtime/sequences/pregenerated/sequences.h	2013-05-08 20:14:47 +0000
+++ src/runtime/sequences/pregenerated/sequences.h	2013-08-16 01:32:34 +0000
@@ -235,7 +235,7 @@
 {
 public:
   bool theHasNaN; //indicates whether NaN was found in the sequence
-  std::auto_ptr<AtomicItemHandleHashSet> theAlreadySeenMap; //hashmap for doing the duplicate elimination
+  std::unique_ptr<AtomicItemHandleHashSet> theAlreadySeenMap; //hashmap for doing the duplicate elimination
 
   FnDistinctValuesIteratorState();
 

=== modified file 'src/runtime/sequences/sequences_impl.cpp'
--- src/runtime/sequences/sequences_impl.cpp	2013-07-12 14:15:52 +0000
+++ src/runtime/sequences/sequences_impl.cpp	2013-08-16 01:32:34 +0000
@@ -1968,7 +1968,7 @@
   // Resolve URI to a stream
   zstring lErrorMessage;
 
-  std::auto_ptr<internal::Resource> lResource =
+  std::unique_ptr<internal::Resource> lResource =
   aSctx->resolve_uri(lNormUri, internal::EntityData::DOCUMENT, lErrorMessage);
 
   internal::StreamResource* lStreamResource =
@@ -2139,7 +2139,7 @@
 
   //Check for a fragment identifier
   //Create a zorba::URI for validating if it contains a fragment  
-  std::auto_ptr<zorba::URI> lUri(new zorba::URI(lNormUri));
+  std::unique_ptr<zorba::URI> lUri(new zorba::URI(lNormUri));
   if (lUri->get_encoded_fragment() != "")
   {
     throw XQUERY_EXCEPTION(err::FOUT1170, ERROR_PARAMS(aUri), ERROR_LOC(loc));    
@@ -2147,7 +2147,7 @@
 
   //Resolve URI to stream
   zstring lErrorMessage;
-  std::auto_ptr<internal::Resource> lResource = aSctx->resolve_uri
+  std::unique_ptr<internal::Resource> lResource = aSctx->resolve_uri
     (lNormUri, internal::EntityData::SOME_CONTENT, lErrorMessage);
 
   internal::StreamResource* lStreamResource =
@@ -2275,9 +2275,9 @@
   zstring encodingString("UTF-8");
   zstring lNormUri;
   zstring lErrorMessage;
-  std::auto_ptr<internal::Resource> lResource;
+  std::unique_ptr<internal::Resource> lResource;
   StreamReleaser lStreamReleaser;
-  std::auto_ptr<zorba::URI> lUri;
+  std::unique_ptr<zorba::URI> lUri;
 
   FnUnparsedTextLinesIteratorState* state;
   DEFAULT_STACK_INIT(FnUnparsedTextLinesIteratorState, state, planState);

=== modified file 'src/runtime/spec/json/jsoniq_functions.xml'
--- src/runtime/spec/json/jsoniq_functions.xml	2013-08-14 15:16:42 +0000
+++ src/runtime/spec/json/jsoniq_functions.xml	2013-08-16 01:32:34 +0000
@@ -202,6 +202,42 @@
 /*******************************************************************************
 ********************************************************************************/
 -->
+<<<<<<< TREE
+=======
+<zorba:iterator name="JSONDocIterator">
+  
+  <zorba:description author="Zorba Team">jn:json-doc</zorba:description>
+  
+  <zorba:function>
+    
+    <zorba:signature localname="json-doc" prefix="fn-jsoniq">
+      <zorba:param>xs:string?</zorba:param>
+      <zorba:output>json-item()*</zorba:output>
+    </zorba:signature>
+    
+    <zorba:methods>
+      <zorba:accessesDynCtx returnValue="true"/>
+      <zorba:isSource returnValue="true"/>
+    </zorba:methods>
+    
+  </zorba:function>
+  
+  <zorba:state generateInit="false" generateReset="false" generateDestructor="false">
+    <zorba:member type="std::unique_ptr&lt;internal::Resource&gt;" name="theResource" brief=""/>
+    <zorba:member type="std::istream*" name="theStream" brief=""/>
+    <zorba:member type="bool" name="theGotOne" brief=""/>
+    <zorba:member type="json::loader*" name="loader_" brief=""/>
+  </zorba:state>
+  
+</zorba:iterator>
+
+
+
+<!--
+/*******************************************************************************
+********************************************************************************/
+-->
+>>>>>>> MERGE-SOURCE
 <zorba:iterator name="JSONItemAccessorIterator">
 
   <zorba:function isDeterministic="true">

=== modified file 'src/runtime/spec/sequences/sequences.xml'
--- src/runtime/spec/sequences/sequences.xml	2013-05-08 20:14:47 +0000
+++ src/runtime/spec/sequences/sequences.xml	2013-08-16 01:32:34 +0000
@@ -242,7 +242,7 @@
                   brief="indicates whether NaN was found in the sequence"/>
 
     <zorba:member name="theAlreadySeenMap"
-                  type="std::auto_ptr&lt;AtomicItemHandleHashSet>"
+                  type="std::unique_ptr&lt;AtomicItemHandleHashSet>"
                   brief="hashmap for doing the duplicate elimination"/>
 
   </zorba:state>

=== modified file 'src/runtime/store/documents_impl.cpp'
--- src/runtime/store/documents_impl.cpp	2013-08-01 11:59:51 +0000
+++ src/runtime/store/documents_impl.cpp	2013-08-16 01:32:34 +0000
@@ -48,7 +48,7 @@
   store::Item_t lUri;
   store::Item_t lDoc;
   store::Item_t lResolvedUriItem;
-  std::auto_ptr<store::PUL> lPul;
+  std::unique_ptr<store::PUL> lPul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);

=== modified file 'src/runtime/store/maps_impl.cpp'
--- src/runtime/store/maps_impl.cpp	2013-06-11 05:40:04 +0000
+++ src/runtime/store/maps_impl.cpp	2013-08-16 01:32:34 +0000
@@ -167,7 +167,7 @@
   store::Item_t              lQName;
   std::vector<store::Item_t> lTypes;
   std::vector<zstring>       lCollations;
-  std::auto_ptr<store::PUL>  lPul;
+  std::unique_ptr<store::PUL>  lPul;
   long                       lTimezone = 0;
 
   PlanIteratorState* state;
@@ -280,7 +280,7 @@
 
   if (getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex))
   {
-    std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
+    std::unique_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList());
     lPul->addDestroyHashMap(&loc, lQName);
 
     apply_updates(
@@ -418,7 +418,7 @@
 
   if (lPersistent)
   {
-    std::auto_ptr<store::PUL>  lPul;
+    std::unique_ptr<store::PUL>  lPul;
     store::Iterator_t lValue
       = new PlanIteratorWrapper(theChildren[1], aPlanState);
 
@@ -437,7 +437,7 @@
     store::Item_t lValue;
     while (consumeNext(lValue, theChildren[1], aPlanState))
     {
-      std::auto_ptr<store::IndexKey> k(new store::IndexKey());
+      std::unique_ptr<store::IndexKey> k(new store::IndexKey());
       for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin();
            lIter != lKey.end();
            ++lIter)
@@ -473,7 +473,7 @@
   store::Index*              lIndex;
   ulong i;
   store::Item_t              lKeyItem;
-  std::auto_ptr<store::PUL>  lPul;
+  std::unique_ptr<store::PUL>  lPul;
   store::IndexSpecification  lSpec;
   bool                       lPersistent;
 

=== modified file 'src/runtime/update/update.cpp'
--- src/runtime/update/update.cpp	2013-06-15 02:57:08 +0000
+++ src/runtime/update/update.cpp	2013-08-16 01:32:34 +0000
@@ -123,7 +123,7 @@
   std::vector<store::Item_t> nodes(16);
   ulong numAttrs = 0;
   ulong numNodes = 0;
-  std::auto_ptr<store::PUL> pul;
+  std::unique_ptr<store::PUL> pul;
   store::Item_t temp;
 
   store::CopyMode lCopyMode;
@@ -316,7 +316,7 @@
 DeleteIterator::nextImpl(store::Item_t& result, PlanState& aPlanState) const
 { 
   store::Item_t target;
-  std::auto_ptr<store::PUL> pul;
+  std::unique_ptr<store::PUL> pul;
 
   PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
@@ -381,7 +381,7 @@
   store::Item_t temp;
   std::vector<store::Item_t> lNodes(16);
   ulong lNumNodes = 0;
-  std::auto_ptr<store::PUL> lPul;
+  std::unique_ptr<store::PUL> lPul;
 
   store::CopyMode lCopyMode;
   bool typePreserve;
@@ -649,7 +649,7 @@
   store::Item_t lNewname;
   store::Item_t qnameItem;
   store::Item_t temp;
-  std::auto_ptr<store::PUL> lPul;
+  std::unique_ptr<store::PUL> lPul;
 
   PlanIteratorState* lState;
   DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);

=== modified file 'src/runtime/util/plan_wrapper_holder.h'
--- src/runtime/util/plan_wrapper_holder.h	2013-02-07 17:24:36 +0000
+++ src/runtime/util/plan_wrapper_holder.h	2013-08-16 01:32:34 +0000
@@ -15,7 +15,6 @@
  */
 #ifndef ZORBA_RUNTIME_UTIL_PLAN_WRAPPER_HOLDER_H
 #define ZORBA_RUNTIME_UTIL_PLAN_WRAPPER_HOLDER_H
-#include <memory>
 
 #include "runtime/api/plan_wrapper.h"
 
@@ -24,7 +23,7 @@
 // RAII-style class
 class PlanWrapperHolder 
 {
-  std::auto_ptr<PlanWrapper> pw;
+  std::unique_ptr<PlanWrapper> pw;
   
 public:
   PlanWrapperHolder (PlanWrapper *pw_)

=== modified file 'src/runtime/xqdoc/xqdoc_impl.cpp'
--- src/runtime/xqdoc/xqdoc_impl.cpp	2013-03-12 17:03:31 +0000
+++ src/runtime/xqdoc/xqdoc_impl.cpp	2013-08-16 01:32:34 +0000
@@ -19,7 +19,6 @@
 #include <iostream>
 #include <sstream>
 #include <fstream>
-#include <memory>
 
 #include "store/api/item_factory.h"
 #include "store/api/store.h"

=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp	2013-07-11 14:04:33 +0000
+++ src/store/naive/node_items.cpp	2013-08-16 01:32:34 +0000
@@ -15,7 +15,6 @@
  */
 #include "stdafx.h"
 
-#include <memory>
 #include <stack>
 
 #include <zorba/config.h>
@@ -2547,7 +2546,7 @@
       // default namespace declaration in scope.
       ZORBA_ASSERT(prefix.empty() || found);
 
-      std::auto_ptr<NsBindingsContext> ctx(new NsBindingsContext);
+      std::unique_ptr<NsBindingsContext> ctx(new NsBindingsContext);
 
       if (found)
       {

=== modified file 'src/store/naive/node_updates.cpp'
--- src/store/naive/node_updates.cpp	2013-02-07 17:24:36 +0000
+++ src/store/naive/node_updates.cpp	2013-08-16 01:32:34 +0000
@@ -436,7 +436,7 @@
           {
             if (nsContext != NULL)
             {
-              std::auto_ptr<NsBindingsContext> ctx(new NsBindingsContext());
+              std::unique_ptr<NsBindingsContext> ctx(new NsBindingsContext());
               elemNode->getNamespaceBindings(ctx->getBindings());
             
               if (!ctx->empty())

=== modified file 'src/store/naive/pul_primitives.cpp'
--- src/store/naive/pul_primitives.cpp	2013-06-15 02:57:08 +0000
+++ src/store/naive/pul_primitives.cpp	2013-08-16 01:32:34 +0000
@@ -1905,7 +1905,7 @@
 
   while (theValue->next(lValue))
   {
-    std::auto_ptr<store::IndexKey> lKey(new store::IndexKey());
+    std::unique_ptr<store::IndexKey> lKey(new store::IndexKey());
     for (std::vector<store::Item_t>::const_iterator lIter = theKey.begin();
          lIter != theKey.end();
          ++lIter)

=== modified file 'src/store/naive/simple_item_factory.cpp'
--- src/store/naive/simple_item_factory.cpp	2013-07-01 18:59:06 +0000
+++ src/store/naive/simple_item_factory.cpp	2013-08-16 01:32:34 +0000
@@ -467,7 +467,7 @@
     const xs_date* date,
     const xs_time* time)
 {
-  std::auto_ptr<DateTimeItem> dtin(new DateTimeItem(store::XS_DATETIME));
+  std::unique_ptr<DateTimeItem> dtin(new DateTimeItem(store::XS_DATETIME));
   int err = DateTime::createDateTime(date, time, dtin->theValue);
   if (err == 0)
   {
@@ -596,7 +596,7 @@
                                       const xs_date* date,
                                       const xs_time* time)
 {
-  std::auto_ptr<DateTimeItem> dtin(new DateTimeItem(store::XS_DATETIME_STAMP));
+  std::unique_ptr<DateTimeItem> dtin(new DateTimeItem(store::XS_DATETIME_STAMP));
   int err = DateTime::createDateTime(date, time, dtin->theValue);
   if (err == 0 && time->hasTimezone())
   {

=== modified file 'src/store/naive/store.cpp'
--- src/store/naive/store.cpp	2013-08-05 11:54:06 +0000
+++ src/store/naive/store.cpp	2013-08-16 01:32:34 +0000
@@ -17,7 +17,6 @@
 
 #include <iostream>
 #include <climits>
-#include <memory>
 
 #include <libxml/parser.h>
 
@@ -996,7 +995,7 @@
   }
 
   XQueryDiagnostics lXQueryDiagnostics;
-  std::auto_ptr<XmlLoader> loader(getXmlLoader(&lXQueryDiagnostics, loadProperties));
+  std::unique_ptr<XmlLoader> loader(getXmlLoader(&lXQueryDiagnostics, loadProperties));
 
   root = loader->loadXml(baseUri, docUri, stream);
 

=== modified file 'src/system/globalenv.cpp'
--- src/system/globalenv.cpp	2013-08-02 18:32:08 +0000
+++ src/system/globalenv.cpp	2013-08-16 01:32:34 +0000
@@ -106,7 +106,7 @@
   m_globalEnv->xqueryx_convertor = new XQueryXConvertor;
 #endif
 
-  std::auto_ptr<XQueryCompilerSubsystem> lSubSystem = 
+  std::unique_ptr<XQueryCompilerSubsystem> lSubSystem = 
   XQueryCompilerSubsystem::create();
 
   m_globalEnv->m_compilerSubSys = lSubSystem.release();

=== modified file 'src/system/globalenv.h'
--- src/system/globalenv.h	2013-08-02 18:32:08 +0000
+++ src/system/globalenv.h	2013-08-16 01:32:34 +0000
@@ -17,7 +17,6 @@
 #ifndef ZORBA_GLOBALENV_H
 #define ZORBA_GLOBALENV_H
 
-#include <memory>
 #include <zorba/config.h>
 
 #include "common/common.h"

=== modified file 'src/system/properties.h'
--- src/system/properties.h	2013-02-07 17:24:36 +0000
+++ src/system/properties.h	2013-08-16 01:32:34 +0000
@@ -20,9 +20,9 @@
 #include <string>
 #include <fstream>
 #include <vector>
-#include <memory>
 
 #include <zorba/config.h>
+#include <zorba/internal/unique_ptr.h>
 #include "system/zorba_properties.h"
 
 namespace zorba {
@@ -35,7 +35,7 @@
 {
  protected:
   std::ostream                 *debug_stream;
-  std::auto_ptr<std::ostream>   debug_stream_ptr;
+  std::unique_ptr<std::ostream>   debug_stream_ptr;
     
  public:
   static Properties* instance();

=== modified file 'src/types/casting.cpp'
--- src/types/casting.cpp	2013-07-12 00:43:14 +0000
+++ src/types/casting.cpp	2013-08-16 01:32:34 +0000
@@ -1283,8 +1283,8 @@
 
 T1_TO_T2(dur, yMD)
 {
-  std::auto_ptr<Duration> dur =
-  std::auto_ptr<Duration>(aItem->getDurationValue().toYearMonthDuration());
+  std::unique_ptr<Duration> dur =
+  std::unique_ptr<Duration>(aItem->getDurationValue().toYearMonthDuration());
   aFactory->createYearMonthDuration(result, dur.get());
   return true;
 }
@@ -1292,8 +1292,8 @@
 
 T1_TO_T2(dur, dTD)
 {
-  std::auto_ptr<Duration> dur =
-  std::auto_ptr<Duration>(aItem->getDurationValue().toDayTimeDuration());
+  std::unique_ptr<Duration> dur =
+  std::unique_ptr<Duration>(aItem->getDurationValue().toDayTimeDuration());
   aFactory->createDayTimeDuration(result, dur.get());
   return true;
 }
@@ -1315,8 +1315,8 @@
 
 T1_TO_T2(yMD, dur)
 {
-  std::auto_ptr<Duration> dur =
-  std::auto_ptr<Duration>(aItem->getYearMonthDurationValue().toDuration());
+  std::unique_ptr<Duration> dur =
+  std::unique_ptr<Duration>(aItem->getYearMonthDurationValue().toDuration());
   aFactory->createDuration(result, dur.get());
   return true;
 }
@@ -1324,8 +1324,8 @@
 
 T1_TO_T2(yMD, dTD)
 {
-  std::auto_ptr<Duration> dur =
-  std::auto_ptr<Duration>(aItem->getYearMonthDurationValue().toDayTimeDuration());
+  std::unique_ptr<Duration> dur =
+  std::unique_ptr<Duration>(aItem->getYearMonthDurationValue().toDayTimeDuration());
   aFactory->createDayTimeDuration(result, dur.get());
   return true;
 }
@@ -1347,8 +1347,8 @@
 
 T1_TO_T2(dTD, dur)
 {
-  std::auto_ptr<Duration> dur =
-  std::auto_ptr<Duration>(aItem->getDayTimeDurationValue().toDuration());
+  std::unique_ptr<Duration> dur =
+  std::unique_ptr<Duration>(aItem->getDayTimeDurationValue().toDuration());
   aFactory->createDuration(result, dur.get());
   return true;
 }
@@ -1356,8 +1356,8 @@
 
 T1_TO_T2(dTD, yMD)
 {
-  std::auto_ptr<Duration> dur =
-  std::auto_ptr<Duration>(aItem->getDayTimeDurationValue().toYearMonthDuration());
+  std::unique_ptr<Duration> dur =
+  std::unique_ptr<Duration>(aItem->getDayTimeDurationValue().toYearMonthDuration());
   aFactory->createYearMonthDuration(result, dur.get());
   return true;
 }

=== modified file 'src/types/schema/XercesParseUtils.cpp'
--- src/types/schema/XercesParseUtils.cpp	2013-06-18 23:53:59 +0000
+++ src/types/schema/XercesParseUtils.cpp	2013-08-16 01:32:34 +0000
@@ -56,7 +56,7 @@
   XSValue::DataType datatype = XSValue::dt_boolean;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -84,7 +84,7 @@
   XSValue::DataType datatype = XSValue::dt_integer;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -112,7 +112,7 @@
   XSValue::DataType datatype = XSValue::dt_positiveInteger;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -140,7 +140,7 @@
   XSValue::DataType datatype = XSValue::dt_nonPositiveInteger;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -168,7 +168,7 @@
   XSValue::DataType datatype = XSValue::dt_negativeInteger;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -196,7 +196,7 @@
   XSValue::DataType datatype = XSValue::dt_nonNegativeInteger;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -224,7 +224,7 @@
   XSValue::DataType datatype = XSValue::dt_unsignedByte;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -252,7 +252,7 @@
   XSValue::DataType datatype = XSValue::dt_unsignedShort;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -280,7 +280,7 @@
   XSValue::DataType datatype = XSValue::dt_unsignedInt;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -308,7 +308,7 @@
   XSValue::DataType datatype = XSValue::dt_unsignedLong;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -336,7 +336,7 @@
   XSValue::DataType datatype = XSValue::dt_byte;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -364,7 +364,7 @@
   XSValue::DataType datatype = XSValue::dt_short;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -392,7 +392,7 @@
   XSValue::DataType datatype = XSValue::dt_int;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -420,7 +420,7 @@
   XSValue::DataType datatype = XSValue::dt_long;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -448,7 +448,7 @@
   XSValue::DataType datatype = XSValue::dt_float;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -487,7 +487,7 @@
   XSValue::DataType datatype = XSValue::dt_double;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -525,7 +525,7 @@
   XSValue::DataType datatype = XSValue::dt_decimal;
   XSValue::Status status = XSValue::st_Init;;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -585,7 +585,7 @@
   XSValue::DataType datatype = XSValue::dt_token;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -613,7 +613,7 @@
   XSValue::DataType datatype = XSValue::dt_NMTOKEN;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -641,7 +641,7 @@
   XSValue::DataType datatype = XSValue::dt_Name;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -670,7 +670,7 @@
   XSValue::DataType datatype = XSValue::dt_NCName;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -698,7 +698,7 @@
   XSValue::DataType datatype = XSValue::dt_ID;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -726,7 +726,7 @@
   XSValue::DataType datatype = XSValue::dt_IDREF;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -754,7 +754,7 @@
   XSValue::DataType datatype = XSValue::dt_ENTITY;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -782,7 +782,7 @@
   XSValue::DataType datatype = XSValue::dt_NOTATION;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -808,7 +808,7 @@
   XSValue::DataType datatype = XSValue::dt_dateTime;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -857,7 +857,7 @@
   XSValue::DataType datatype = XSValue::dt_date;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -897,7 +897,7 @@
   XSValue::DataType datatype = XSValue::dt_time;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -941,7 +941,7 @@
   XSValue::DataType datatype = XSValue::dt_gYearMonth;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -976,7 +976,7 @@
   XSValue::DataType datatype = XSValue::dt_gYear;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -1010,7 +1010,7 @@
   XSValue::DataType datatype = XSValue::dt_gMonthDay;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -1044,7 +1044,7 @@
   XSValue::DataType datatype = XSValue::dt_gDay;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -1077,7 +1077,7 @@
   XSValue::DataType datatype = XSValue::dt_gMonth;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -1110,7 +1110,7 @@
   XSValue::DataType datatype = XSValue::dt_duration;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -1201,7 +1201,7 @@
   XSValue::DataType datatype = XSValue::dt_base64Binary;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -1229,7 +1229,7 @@
   XSValue::DataType datatype = XSValue::dt_hexBinary;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_Init )
@@ -1255,7 +1255,7 @@
   XSValue::DataType datatype = XSValue::dt_anyURI;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )
@@ -1281,7 +1281,7 @@
   XSValue::DataType datatype = XSValue::dt_QName;
   XSValue::Status status = XSValue::st_Init;
 
-  auto_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
+  unique_ptr<XSValue> xsval (XSValue::getActualValue(content, datatype, status));
   XMLString::release(&content);
 
   if ( status==XSValue::st_NoActVal )

=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp	2013-07-01 18:59:06 +0000
+++ src/types/schema/schema.cpp	2013-08-16 01:32:34 +0000
@@ -216,7 +216,7 @@
         isSystemId = true;
       }
       
-      std::auto_ptr<internal::Resource> lResource;
+      std::unique_ptr<internal::Resource> lResource;
       
       zstring lStrId = StrX(lId).localForm();
       zstring lResolved;
@@ -435,7 +435,7 @@
     internal::StreamResource* stream,
     const QueryLoc& loc)
 {
-  std::auto_ptr<SAX2XMLReader> parser;
+  std::unique_ptr<SAX2XMLReader> parser;
 
   TRACE("url=" << xsdURL << " loc=" << loc);
 
@@ -1708,7 +1708,7 @@
   try
   {
     // Create grammar resolver and string pool that we pass to the scanner
-    std::auto_ptr<GrammarResolver> fGrammarResolver(
+    std::unique_ptr<GrammarResolver> fGrammarResolver(
     new GrammarResolver(theGrammarPool));
 
     fGrammarResolver->useCachedGrammarInParse(true);

=== removed file 'src/util/auto_vector.h'
--- src/util/auto_vector.h	2013-02-07 17:24:36 +0000
+++ src/util/auto_vector.h	1970-01-01 00:00:00 +0000
@@ -1,266 +0,0 @@
-#pragma once
-#if !defined AUTO_VECTOR_H
-#define AUTO_VECTOR_H
-//------------------------------------
-// Reliable Software (c) 2003
-// www.relisoft.com
-// Any use, commercial or noncommercial of this code
-// is hereby granted, under the condition
-// that this copyright notice be not removed.
-//------------------------------------
-
-#include <memory>
-#include <vector>
-#include <cassert>
-#include <algorithm>
-
-//---------------------------------
-// Dynamic array of owned pointers. 
-// Ownership transfer semantics.
-//---------------------------------
-
-namespace zorba {
-namespace ztd {
-
-template <class T> 
-class auto_vector
-{
-public:
-  class auto_lvalue
-  {
-  public:
-    auto_lvalue (T * & p) : _p (p) {}
-    operator T * () const { return _p; }
-    T * operator-> () const { return _p; }
-    auto_lvalue & operator= (std::auto_ptr<T> ap)
-    {
-      delete _p;
-      _p = ap.release ();
-      return *this;
-    }
-  private:
-    T * & _p;
-  };
-public:
-
-  explicit auto_vector (size_t capacity = 0);
-  ~auto_vector ();
-
-  // memory management
-  size_t  size () const { return _arr.size (); }
-  size_t  capacity () const { return _arr.capacity (); }
-  void reserve (size_t count);
-  void resize (unsigned int newSize);
-  void erase (size_t idx);
-  void clear ();
-  void compact ();
-  void swap (auto_vector<T> & other)
-  {
-    _arr.swap (other._arr);
-  }
-  // array access
-  T const * operator [] (size_t i) const { return _arr [i]; }
-  auto_lvalue operator [] (size_t i) 
-  { 
-    return auto_lvalue (_arr [i]); 
-  }
-  void assign (size_t i, std::auto_ptr<T> p);
-  void assign_direct (size_t i, T * p);
-  void insert (size_t idx, std::auto_ptr<T> p);
-  // stack access
-  void push_back (std::auto_ptr<T> p);
-  std::auto_ptr<T> pop_back (); // non-standard
-  T * back () { return _arr.back (); }
-  T const * back () const { return _arr.back (); }
-  T * front () { return _arr.front (); }
-  T const * front () const { return _arr.front (); }
-  // iterators
-  typedef typename std::vector<T*>::iterator               iterator;
-  typedef typename std::vector<T*>::const_iterator         const_iterator;
-  typedef typename std::vector<T*>::reverse_iterator       reverse_iterator;
-  typedef typename std::vector<T*>::const_reverse_iterator const_reverse_iterator;
-
-
-  iterator                begin () { return _arr.begin (); }
-  iterator                end () { return _arr.end (); }
-  const_iterator          begin () const { return _arr.begin (); }
-  const_iterator          end () const { return _arr.end (); }
-  reverse_iterator        rbegin() { return _arr.rbegin (); }
-  reverse_iterator        rend()   { return _arr.rend (); }
-  const_reverse_iterator  rbegin() const  { return _arr.rbegin (); }
-  const_reverse_iterator  rend() const    { return _arr.rend (); }
-
-  iterator erase (iterator it);
-
-  // iterator/index conversion
-  size_t ToIndex (iterator const & it);
-  size_t ToIndex (reverse_iterator const & rit); 
-  iterator ToIter (size_t idx);
-  reverse_iterator ToRIter (size_t idx);
-
-  // Copy-constructor - much like auto_ptr<>'s copy constructor, this does
-  // NOT implement copy semantics, but instead transfers ownership of all
-  // items in src to this new auto_vector.
-  auto_vector (auto_vector<T> const & src);
-
-private:
-  auto_vector<T> & operator= (auto_vector<T> const & src);
-
-  std::vector<T*> _arr;
-};
-
-template <class T>
-auto_vector<T>::auto_vector (size_t capacity)
-{
-  _arr.reserve (capacity);
-}
-
-template <class T>
-auto_vector<T>::auto_vector (auto_vector<T> const & src)
-{
-  _arr = src._arr;
-  const_cast<auto_vector<T> &>(src)._arr.clear();
-}
-
-template <class T>
-auto_vector<T>::~auto_vector ()
-{
-  clear ();
-}
-
-template <class T>
-void auto_vector<T>::push_back (std::auto_ptr<T> ptr)
-{
-  _arr.push_back (ptr.get ());
-  ptr.release ();
-}
-
-template <class T>
-inline std::auto_ptr<T> auto_vector<T>::pop_back () 
-{
-  assert (size () != 0);
-  T * p = _arr.back ();
-  _arr.pop_back ();
-  return std::auto_ptr<T> (p);
-}
-
-template <class T>
-class DeletePtr
-{
-public:
-  void operator () (T * p)
-  {
-    delete p;
-  }
-};
-
-template <class T>
-void auto_vector<T>::clear ()
-{
-  std::for_each (begin (), end (), DeletePtr<T> ());
-  _arr.clear ();
-}
-
-template <class T>
-inline void auto_vector<T>::assign_direct (size_t i, T * p)
-{
-  assert (i < size ());
-  if (_arr [i] != p)
-    delete _arr [i];
-  _arr [i] = p;
-}
-
-template <class T>
-inline void auto_vector<T>::assign (size_t i, std::auto_ptr<T> p)
-{
-  assert (i < size ());
-  if (_arr [i] != p.get ())
-    delete _arr [i];
-  _arr [i] = p.release ();
-}
-
-template <class T>
-void auto_vector<T>::erase (size_t idx)
-{
-  assert (idx < size ());
-  // Delete item
-  delete _arr [idx];
-  // Compact array
-  _arr.erase (ToIter (idx));
-}
-
-template <class T>
-typename auto_vector<T>::iterator auto_vector<T>::erase (typename auto_vector<T>::iterator it)
-{
-  assert (it < end ());
-  delete *it;
-  return _arr.erase (it);
-}
-
-template <class T>
-void auto_vector<T>::compact ()
-{
-  // move null pointers to the end
-  T * null = 0;
-  iterator pos = std::remove (begin (), end (), null);
-  _arr.resize (pos - begin ());
-}
-
-template <class T>
-size_t auto_vector<T>::ToIndex (iterator const & it)  
-{
-  assert (it - begin () >= 0);
-  return static_cast<size_t> (it - begin ());
-}
-
-template <class T>
-size_t auto_vector<T>::ToIndex (reverse_iterator const & rit)  
-{
-  iterator it = rit.base ();
-  --it;
-  assert (it - begin () >= 0);
-  return static_cast<size_t> (it - begin ());
-}
-
-template <class T>
-typename auto_vector<T>::iterator auto_vector<T>::ToIter (size_t idx) 
-{ 
-  return begin () + idx;
-}
-
-template <class T>
-typename auto_vector<T>::reverse_iterator auto_vector<T>::ToRIter (size_t idx) 
-{
-  ++idx;
-  return reverse_iterator (ToIter (idx));
-}
-
-
-template <class T>
-inline void auto_vector <T>::reserve (size_t count)
-{
-  _arr.reserve (count);
-}
-
-template <class T>
-inline void auto_vector<T>::resize (unsigned int newSize)
-{
-  if (newSize < size ())
-    std::for_each (ToIter (newSize), end (), DeletePtr<T> ());
-  _arr.resize (newSize);
-}
-
-template <class T>
-void auto_vector<T>::insert (size_t idx, std::auto_ptr<T> p)
-{
-  assert (idx <= size ());
-  _arr.insert (ToIter (idx), p.get ());
-  p.release ();
-}
-
-} /* namespace ztd */
-} /* namespace zorba */
-
-#endif
-
-/* vim:set et sw=2 ts=2: */

=== modified file 'src/util/singleton.h'
--- src/util/singleton.h	2013-02-07 17:24:36 +0000
+++ src/util/singleton.h	2013-08-16 01:32:34 +0000
@@ -160,7 +160,7 @@
             pTrackerArray = new TrackerArray;
 
         // automatically delete the ConcreteLifetimeTracker object when a exception is thrown
-        std::auto_ptr<LifetimeTracker> 
+        std::unique_ptr<LifetimeTracker> 
             p( new ConcreteLifetimeTracker<T, Destroyer>(pDynObject, longevity, d) );
 
         // Find correct position

=== modified file 'src/util/zorba_regex_engine.cpp'
--- src/util/zorba_regex_engine.cpp	2013-04-25 02:05:20 +0000
+++ src/util/zorba_regex_engine.cpp	2013-08-16 01:32:34 +0000
@@ -127,7 +127,7 @@
   *regex_len = 0;
   int   branch_len;
   regex_depth++;
-  std::auto_ptr<CRegexXQuery_regex>  regex(new CRegexXQuery_regex(current_regex));
+  std::unique_ptr<CRegexXQuery_regex>  regex(new CRegexXQuery_regex(current_regex));
   if(!current_regex)
     current_regex = regex.get();
   if(regex_depth >= 2)
@@ -172,7 +172,7 @@
 {
   int piece_len;
 
-  std::auto_ptr<CRegexXQuery_branch>    branch(new CRegexXQuery_branch(current_regex));
+  std::unique_ptr<CRegexXQuery_branch>    branch(new CRegexXQuery_branch(current_regex));
   CRegexXQuery_piece     *piece;
   *branch_len = 0;
   while(pattern[*branch_len] && (pattern[*branch_len] != '|') && (pattern[*branch_len] != ')'))
@@ -198,7 +198,7 @@
 //piece = atom + quantifier
 CRegexXQuery_piece* CRegexXQuery_parser::parse_piece(const char *pattern, int *piece_len)
 {
-  std::auto_ptr<CRegexXQuery_piece>  piece(new CRegexXQuery_piece);
+  std::unique_ptr<CRegexXQuery_piece>  piece(new CRegexXQuery_piece);
   IRegexAtom  *atom;
   *piece_len = 0;
 
@@ -767,7 +767,7 @@
         break;
     }
     /*
-    std::auto_ptr<CRegexXQuery_chargroup> chargroup(new CRegexXQuery_chargroup(current_regex));
+    std::unique_ptr<CRegexXQuery_chargroup> chargroup(new CRegexXQuery_chargroup(current_regex));
     if(multichar_type)
       chargroup->addMultiChar(c, multichar_type);
     else if(is_end_line)
@@ -787,7 +787,7 @@
 //charRange     ::=    seRange | XmlCharIncDash
 CRegexXQuery_chargroup* CRegexXQuery_parser::readchargroup(const char *pattern, int *chargroup_len)
 {
-  std::auto_ptr<CRegexXQuery_chargroup> chargroup;
+  std::unique_ptr<CRegexXQuery_chargroup> chargroup;
   *chargroup_len = 0;
   if(pattern[*chargroup_len] == '^')//negative group
   {

=== modified file 'src/zorbatypes/collation_manager.cpp'
--- src/zorbatypes/collation_manager.cpp	2013-02-07 17:24:36 +0000
+++ src/zorbatypes/collation_manager.cpp	2013-08-16 01:32:34 +0000
@@ -23,7 +23,6 @@
 
 #include <vector>
 #include <iostream>
-#include <memory>
 #include <assert.h>
 #include <cstring>
 #include <cstdlib>
@@ -33,7 +32,7 @@
 namespace zorba {
 
   /**
-   * Method splits the passed string into tokes. 
+   * Method splits the passed string into tokens.
    * Delimiters are all characters passed in the variable delims.
    */
 std::vector<std::string> std_string_tokenize(

=== modified file 'src/zorbatypes/datetime/datetimetype.cpp'
--- src/zorbatypes/datetime/datetimetype.cpp	2013-05-22 16:12:01 +0000
+++ src/zorbatypes/datetime/datetimetype.cpp	2013-08-16 01:32:34 +0000
@@ -20,7 +20,6 @@
 #include <string>
 #include <exception>
 #include <cassert>
-#include <memory>
 
 #ifndef WIN32
 #include <sys/time.h>
@@ -396,7 +395,7 @@
   if (dt.data[HOUR_DATA] == 24)
   {
     dt.data[HOUR_DATA] = 0;
-    std::auto_ptr<DateTime> tmp(dt.addDuration(Duration(Duration::DAYTIMEDURATION_FACET,
+    std::unique_ptr<DateTime> tmp(dt.addDuration(Duration(Duration::DAYTIMEDURATION_FACET,
                                                         false, 0, 0, 1, 0, 0, 0)));
     dt = *tmp;
   }
@@ -1045,8 +1044,8 @@
 
 int DateTime::compare(const DateTime* dt, long timezone_seconds) const
 {
-  std::auto_ptr<DateTime> d1_t;
-  std::auto_ptr<DateTime> d2_t;
+  std::unique_ptr<DateTime> d1_t;
+  std::unique_ptr<DateTime> d2_t;
 
   d1_t.reset(normalizeTimeZone(timezone_seconds));
   d2_t.reset(dt->normalizeTimeZone(timezone_seconds));
@@ -1085,7 +1084,7 @@
 uint32_t DateTime::hash(int implicit_timezone_seconds) const
 {
   uint32_t hval = 0;
-  std::auto_ptr<DateTime> dt(normalizeTimeZone(implicit_timezone_seconds));
+  std::unique_ptr<DateTime> dt(normalizeTimeZone(implicit_timezone_seconds));
 
   hval = hashfun::h32<int>((int)dt->facet, hval);
   hval = hashfun::h32<int>(dt->data[YEAR_DATA], hval);
@@ -1216,7 +1215,7 @@
 
 DateTime* DateTime::subtractDuration(const Duration& d, bool adjust_facet) const
 {
-  std::auto_ptr<Duration> negD(d.toNegDuration());
+  std::unique_ptr<Duration> negD(d.toNegDuration());
   return addDuration(*negD, adjust_facet);
 }
 
@@ -1225,10 +1224,10 @@
     const DateTime* dt,
     int implicit_timezone_seconds) const
 {
-  std::auto_ptr<DateTime> dt1(normalizeTimeZone(implicit_timezone_seconds));
-  std::auto_ptr<DateTime> dt2(dt->normalizeTimeZone(implicit_timezone_seconds));
-  std::auto_ptr<Duration> dur1(dt1->toDayTimeDuration());
-  std::auto_ptr<Duration> dur2(dt2->toDayTimeDuration());
+  std::unique_ptr<DateTime> dt1(normalizeTimeZone(implicit_timezone_seconds));
+  std::unique_ptr<DateTime> dt2(dt->normalizeTimeZone(implicit_timezone_seconds));
+  std::unique_ptr<Duration> dur1(dt1->toDayTimeDuration());
+  std::unique_ptr<Duration> dur2(dt2->toDayTimeDuration());
   return *dur1 - *dur2;
 }
 
@@ -1262,18 +1261,18 @@
 
 DateTime* DateTime::adjustToTimeZone(int tz_seconds) const
 {
-  std::auto_ptr<Duration> dtduration;
-  std::auto_ptr<Duration> context_tz;
-  std::auto_ptr<DateTime> dt;
+  std::unique_ptr<Duration> dtduration;
+  std::unique_ptr<Duration> context_tz;
+  std::unique_ptr<DateTime> dt;
 
   // validate timezone value (-14 .. +14 H)
   if (tz_seconds > 14*3600 || tz_seconds < -14*3600)
     throw InvalidTimezoneException( tz_seconds );
 
   // If $timezone is not specified, then $timezone is the value of the implicit timezone in the dynamic context.
-  context_tz = std::auto_ptr<Duration>(new Duration(Duration::DAYTIMEDURATION_FACET, (tz_seconds<0), 0, 0, 0, 0, 0, tz_seconds, 0));
+  context_tz = std::unique_ptr<Duration>(new Duration(Duration::DAYTIMEDURATION_FACET, (tz_seconds<0), 0, 0, 0, 0, 0, tz_seconds, 0));
 
-  dt = std::auto_ptr<DateTime>(new DateTime(*this));
+  dt = std::unique_ptr<DateTime>(new DateTime(*this));
 
   // If $arg does not have a timezone component and $timezone is not the empty sequence,
   // then the result is $arg with $timezone as the timezone component.
@@ -1288,7 +1287,7 @@
   {
     // If $arg has a timezone component and $timezone is not the empty sequence, then
     // the result is an xs:dateTime value with a timezone component of $timezone that is equal to $arg.
-    dtduration = std::auto_ptr<Duration>(new Duration(Duration::DAYTIMEDURATION_FACET,
+    dtduration = std::unique_ptr<Duration>(new Duration(Duration::DAYTIMEDURATION_FACET,
                                                       the_time_zone < 0,
                                                       0, 0, 0,
                                                       the_time_zone.getHours(),
@@ -1296,8 +1295,8 @@
                                                       0,
                                                       0));
 
-    dtduration = std::auto_ptr<Duration>(*context_tz - *dtduration);
-    dt = std::auto_ptr<DateTime>(dt->addDuration(*dtduration));
+    dtduration = std::unique_ptr<Duration>(*context_tz - *dtduration);
+    dt = std::unique_ptr<DateTime>(dt->addDuration(*dtduration));
     dt->the_time_zone = TimeZone(
       context_tz->getHours(),
       context_tz->getMinutes()
@@ -1310,14 +1309,14 @@
 
 DateTime* DateTime::adjustToTimeZone(const Duration* d) const
 {
-  std::auto_ptr<Duration> dtduration;
-  std::auto_ptr<const Duration> context_tz;
-  std::auto_ptr<DateTime> dt;
+  std::unique_ptr<Duration> dtduration;
+  std::unique_ptr<const Duration> context_tz;
+  std::unique_ptr<DateTime> dt;
 
   // A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H
   // or greater than PT14H or if does not contain an integral number of minutes.
 
-  dt = std::auto_ptr<DateTime>(new DateTime(*this));
+  dt = std::unique_ptr<DateTime>(new DateTime(*this));
 
   if (d == NULL)
   {
@@ -1345,19 +1344,19 @@
     {
       // If $arg has a timezone component and $timezone is not the empty sequence, then
       // the result is an xs:dateTime value with a timezone component of $timezone that is equal to $arg.
-      dtduration = std::auto_ptr<Duration>(new Duration(Duration::DAYTIMEDURATION_FACET,
-                                                        the_time_zone < 0,
-                                                        0, 0, 0,
-                                                        the_time_zone.getHours(),
-                                                        the_time_zone.getMinutes(),
-                                                        0,
-                                                        0));
+      dtduration.reset(new Duration(Duration::DAYTIMEDURATION_FACET,
+                                    the_time_zone < 0,
+                                    0, 0, 0,
+                                    the_time_zone.getHours(),
+                                    the_time_zone.getMinutes(),
+                                    0,
+                                    0));
 
-      context_tz = std::auto_ptr<Duration>(new Duration(*d));
+      context_tz.reset(new Duration(*d));
       if (context_tz.get() == NULL)
         assert(0);
 
-      dtduration = std::auto_ptr<Duration>(*context_tz - *dtduration);
+      dtduration.reset(*context_tz - *dtduration);
       dt.reset(dt->addDuration(*dtduration));
 
       dt->the_time_zone = TimeZone(

=== modified file 'src/zorbatypes/datetime/duration.cpp'
--- src/zorbatypes/datetime/duration.cpp	2013-05-22 02:22:35 +0000
+++ src/zorbatypes/datetime/duration.cpp	2013-08-16 01:32:34 +0000
@@ -16,7 +16,6 @@
 #include "stdafx.h"
 
 #include <cmath>
-#include <memory>
 #include <string>
 
 #include "zorbatypes/datetime.h"
@@ -724,7 +723,7 @@
 
 Duration* Duration::operator-(const Duration& d) const
 {
-  std::auto_ptr<Duration> temp = std::auto_ptr<Duration>(d.toNegDuration());
+  std::unique_ptr<Duration> temp = std::unique_ptr<Duration>(d.toNegDuration());
   return operator+(*temp);
 }
 

=== modified file 'test/api/userdefined_uri_resolution.cpp'
--- test/api/userdefined_uri_resolution.cpp	2013-06-20 11:05:03 +0000
+++ test/api/userdefined_uri_resolution.cpp	2013-08-16 01:32:34 +0000
@@ -17,7 +17,6 @@
 #include <iostream>
 #include <sstream>
 #include <vector>
-#include <memory>
 #include <zorba/zorba.h>
 #include <zorba/store_manager.h>
 #include <zorba/zorba_exception.h>

=== modified file 'test/apitest.cpp'
--- test/apitest.cpp	2013-08-05 11:24:53 +0000
+++ test/apitest.cpp	2013-08-16 01:32:34 +0000
@@ -20,7 +20,6 @@
 #include <iostream>
 #include <iomanip>
 #include <sstream>
-#include <memory>
 
 // tests are allowed to use internals
 #include "api/unmarshaller.h"
@@ -121,14 +120,14 @@
   }
 
   // output file (either a file or the standard out if no file is specified)
-  auto_ptr<ostream> outputFile (lProp->resultFile ().empty ()
+  unique_ptr<ostream> outputFile (lProp->resultFile ().empty ()
                                 ? NULL : new ofstream (lProp->resultFile().c_str()));
   ostream *resultFile = outputFile.get ();
   if (resultFile == NULL)
     resultFile = &cout;
 
   // input file (either from a file or given as parameter)
-  auto_ptr<istream> qfile;
+  unique_ptr<istream> qfile;
   std::string path;
 
   if (! lProp->inlineQuery()) 
@@ -273,7 +272,7 @@
   //if you want to print the plan into a file
   if( ! lProp->dotPlanFile().empty () ) 
   {
-    auto_ptr<ostream> planFile (new ofstream (lProp->dotPlanFile().c_str()));
+    unique_ptr<ostream> planFile (new ofstream (lProp->dotPlanFile().c_str()));
     ostream *printPlanFile = planFile.get ();
 
     query->printPlan(*printPlanFile, true);

=== modified file 'test/driver/testdriver.cpp'
--- test/driver/testdriver.cpp	2013-08-09 08:27:30 +0000
+++ test/driver/testdriver.cpp	2013-08-16 01:32:34 +0000
@@ -157,11 +157,11 @@
     bool isW3Ctest = isW3CFTtest || isW3CXQTStest;
     std::string lQueryWithoutSuffix = 
     std::string(argv[i]).substr( 0, std::string(argv[i]).rfind('.') );
-    std::auto_ptr<zorba::TestSchemaURIMapper>        smapper;
-    std::auto_ptr<zorba::TestModuleURIMapper>        mmapper;
-    std::auto_ptr<zorba::TestCollectionURIMapper>    cmapper;
-    std::auto_ptr<zorba::TestSchemeURIMapper>        dmapper;
-    std::auto_ptr<zorba::TestURLResolver>            tresolver;
+    std::unique_ptr<zorba::TestSchemaURIMapper>        smapper;
+    std::unique_ptr<zorba::TestModuleURIMapper>        mmapper;
+    std::unique_ptr<zorba::TestCollectionURIMapper>    cmapper;
+    std::unique_ptr<zorba::TestSchemeURIMapper>        dmapper;
+    std::unique_ptr<zorba::TestURLResolver>            tresolver;
 
     // Create the static context. If this is a w3c query, install special uri
     // resolvers in the static context.

=== modified file 'test/driver/testdriver_mt.cpp'
--- test/driver/testdriver_mt.cpp	2013-08-09 08:27:30 +0000
+++ test/driver/testdriver_mt.cpp	2013-08-16 01:32:34 +0000
@@ -405,12 +405,12 @@
   std::string mod_map_file = rbkt_src_dir + w3cDataDir + "module.txt";
   std::string col_map_file = rbkt_src_dir + w3cDataDir + "collection.txt";
 
-  std::auto_ptr<zorba::TestSchemaURIMapper> smapper;
-  std::auto_ptr<zorba::TestModuleURIMapper> mmapper;
-  std::auto_ptr<zorba::TestCollectionURIMapper> cmapper;
+  std::unique_ptr<zorba::TestSchemaURIMapper> smapper;
+  std::unique_ptr<zorba::TestModuleURIMapper> mmapper;
+  std::unique_ptr<zorba::TestCollectionURIMapper> cmapper;
 
-  std::auto_ptr<zorba::TestSchemeURIMapper> dmapper;
-  std::auto_ptr<zorba::TestURLResolver> tresolver;
+  std::unique_ptr<zorba::TestSchemeURIMapper> dmapper;
+  std::unique_ptr<zorba::TestURLResolver> tresolver;
 
   DriverContext driverContext(zorba);
   driverContext.theRbktSourceDir = rbkt_src_dir;

=== modified file 'test/driver/updtestdriver.cpp'
--- test/driver/updtestdriver.cpp	2013-08-09 08:27:30 +0000
+++ test/driver/updtestdriver.cpp	2013-08-16 01:32:34 +0000
@@ -274,7 +274,7 @@
   Zorba_SerializerOptions lSerOptions;
   lSerOptions.omit_xml_declaration = ZORBA_OMIT_XML_DECLARATION_YES;
 
-  std::auto_ptr<zorba::TestSchemaURIMapper> smapper;
+  std::unique_ptr<zorba::TestSchemaURIMapper> smapper;
 
   ulong numQueries = (ulong)lSpec.theStates.size();
 

=== modified file 'test/rbkt/modules/link.xq.src/link.cpp'
--- test/rbkt/modules/link.xq.src/link.cpp	2013-02-07 17:24:36 +0000
+++ test/rbkt/modules/link.xq.src/link.cpp	2013-08-16 01:32:34 +0000
@@ -68,8 +68,8 @@
   doub1[0] = '1';
   doub2[0] = '2';
   doub1[1] = doub2[1] = '\0';
-  std::auto_ptr<XMLDouble> xdoub1(new XMLDouble(doub1));
-  std::auto_ptr<XMLDouble> xdoub2(new XMLDouble(doub2));
+  std::unique_ptr<XMLDouble> xdoub1(new XMLDouble(doub1));
+  std::unique_ptr<XMLDouble> xdoub2(new XMLDouble(doub2));
   int lComp = XMLDouble::compareValues(xdoub1.get(), xdoub2.get());
   zorba::Item lStr =
     Zorba::getInstance(0)->getItemFactory()->createInteger(lComp);
@@ -86,7 +86,7 @@
   zorba::StaticContext const* aSctx, zorba::DynamicContext const* aDctx) const
 {
   // Silly test case
-  std::auto_ptr<Ourlib> lOurlib(new Ourlib(55));
+  std::unique_ptr<Ourlib> lOurlib(new Ourlib(55));
   int lVal = lOurlib->ourfunc();
   zorba::Item lStr =
     Zorba::getInstance(0)->getItemFactory()->createInteger(lVal);


References