From 0fdf19714613a82a184f4f6e75fb9a4f9b62f18a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 19 Jan 2014 10:05:08 +0200 Subject: Use std::unique_ptr instead of std::auto_ptr in C++11 mode --- doc/cxx/tree/guide/index.xhtml | 80 ++++++++---- doc/cxx/tree/manual/index.xhtml | 228 ++++++++++++++++++++++------------ doc/cxx/tree/reference/libxsd.doxygen | 12 +- 3 files changed, 216 insertions(+), 104 deletions(-) (limited to 'doc/cxx/tree') diff --git a/doc/cxx/tree/guide/index.xhtml b/doc/cxx/tree/guide/index.xhtml index 7d2ac54..df54d1f 100644 --- a/doc/cxx/tree/guide/index.xhtml +++ b/doc/cxx/tree/guide/index.xhtml @@ -226,10 +226,11 @@ 3Overall Mapping Configuration - - - - + + + + +
3.1Character Type and Encoding
3.2Support for Polymorphism
3.3Namespace Mapping
3.4Thread Safety
3.1C++ Standard
3.2Character Type and Encoding
3.3Support for Polymorphism
3.4Namespace Mapping
3.5Thread Safety
@@ -621,8 +622,29 @@ hello (std::istream&); global element in XML Schema is a valid document root. By default XSD generated a set of parsing functions for each global element defined in XML Schema (this can be overridden - with the --root-element-* options). For more - information on parsing functions see Chapter 5, + with the --root-element-* options). Parsing + functions return a dynamically allocated object model as an + automatic pointer. The actual pointer used depends on the + C++ standard selected. For C++98 it is std::auto_ptr + as shown above. For C++11 it is std::unique_ptr. + For example, if we modify our XSD compiler invocation to + select C++11:

+ +
+$ xsd cxx-tree --std c++11 hello.xsd
+  
+ +

Then the parsing function signatures will become:

+ +
+std::unique_ptr<hello_t>
+hello (const std::string& uri);
+
+std::unique_ptr<hello_t>
+hello (std::istream&);
+  
+ +

For more information on parsing functions see Chapter 5, "Parsing".

2.3 Implementing Application Logic

@@ -1134,16 +1156,25 @@ $ doxygen hello.doxygen determine the overall properties and behavior of the generated code. Configuration parameters are specified with the XSD command line options. This chapter describes configuration aspects that are most - commonly encountered by application developers. These include: - the character type that is used by the generated code, handling of - vocabularies that use XML Schema polymorphism, XML Schema to C++ - namespace mapping, and thread safety. For more ways to configure + commonly encountered by application developers. These include: the + C++ standard, the character type that is used by the generated code, + handling of vocabularies that use XML Schema polymorphism, XML Schema + to C++ namespace mapping, and thread safety. For more ways to configure the generated code refer to the XSD Compiler Command Line Manual.

-

3.1 Character Type and Encoding

+

3.1 C++ Standard

+ +

The C++/Tree mapping provides support for ISO/IEC C++ 1998/2003 (C++98) + and ISO/IEC C++ 2011 (C++11). To select the C++ standard for the + generated code we use the --std XSD compiler command + line option. While the majority of the examples in this guide use + C++98, support for the new functionality and library components + introduced in C++11 are discussed throughout the document.

+ +

3.2 Character Type and Encoding

The C++/Tree mapping has built-in support for two character types: char and wchar_t. You can select the @@ -1174,7 +1205,7 @@ $ doxygen hello.doxygen all three (object mode, input XML, and output XML) can have different encodings.

-

3.2 Support for Polymorphism

+

3.3 Support for Polymorphism

By default XSD generates non-polymorphic code. If your vocabulary uses XML Schema polymorphism in the form of xsi:type @@ -1186,7 +1217,7 @@ $ doxygen hello.doxygen "Mapping for xsi:type and Substitution Groups" in the C++/Tree Mapping User Manual.

-

3.3 Namespace Mapping

+

3.4 Namespace Mapping

XSD maps XML namespaces specified in the targetNamespace attribute in XML Schema to one or more nested C++ namespaces. By @@ -1213,7 +1244,7 @@ $ doxygen hello.doxygen --namespace-map =cs -

3.4 Thread Safety

+

3.5 Thread Safety

XSD-generated code is thread-safe in the sense that you can use different instantiations of the object model in several @@ -1829,7 +1860,7 @@ ps.push_back (jane); of the passed objects:

-// Add the John Doe record.
+// Add the John Doe record. C++98 version.
 //
 auto_ptr<person_t> john_p (
   new person_t ("John",           // first-name
@@ -1839,15 +1870,15 @@ auto_ptr<person_t> john_p (
                 1));
 ps.push_back (john_p); // assumes ownership
 
-// Add the Jane Doe record.
+// Add the Jane Doe record. C++11 version
 //
-auto_ptr<person_t> jane_p (
+unique_ptr<person_t> jane_p (
   new person_t ("Jane",           // first-name
                 "Doe",            // last-name
                 gender_t::female, // gender
                 28,               // age
                 2));              // id
-ps.push_back (jane_p); // assumes ownership
+ps.push_back (std::move (jane_p)); // assumes ownership
   

For more information on the non-copying modifier functions refer to @@ -2221,17 +2252,17 @@ ps.push_back (jane_p); // assumes ownership on the following three parsing functions:

-std::auto_ptr<people_t>
+std::[auto|unique]_ptr<people_t>
 people (const std::string& uri,
 	xml_schema::flags f = 0,
 	const xml_schema::properties& p = xml_schema::properties ());
 
-std::auto_ptr<people_t>
+std::[auto|unique]_ptr<people_t>
 people (std::istream& is,
         xml_schema::flags f = 0,
         const xml_schema::properties& p = xml_schema::properties ());
 
-std::auto_ptr<people_t>
+std::[auto|unique]_ptr<people_t>
 people (std::istream& is,
         const std::string& resource_id,
         xml_schema::flags f = 0,
@@ -2251,8 +2282,11 @@ people (std::istream& is,
      to fine-tune the parsing process. The properties argument allows
      to pass additional information to the parsing functions. We will
      use these two arguments in Section 5.1, "XML Schema
-     Validation and Searching" below. The following example shows
-     how we can use the above parsing functions:

+ Validation and Searching" below. All three functions return + the object model as either std::auto_ptr (C++98) or + std::unique_ptr (C++11), depending on the C++ standard + selected (--std XSD compiler option). The following + example shows how we can use the above parsing functions:

 using std::auto_ptr;
diff --git a/doc/cxx/tree/manual/index.xhtml b/doc/cxx/tree/manual/index.xhtml
index d022919..05e1bef 100644
--- a/doc/cxx/tree/manual/index.xhtml
+++ b/doc/cxx/tree/manual/index.xhtml
@@ -225,10 +225,11 @@
           
             2.1Preliminary Information
               
-                
-                
-                
-		
+		
+                
+                
+                
+		
2.1.1Identifiers
2.1.2Character Type and Encoding
2.1.3XML Schema Namespace
2.1.4Anonymous Types
2.1.1C++ Standard
2.1.2Identifiers
2.1.3Character Type and Encoding
2.1.4XML Schema Namespace
2.1.5Anonymous Types
@@ -517,7 +518,16 @@

2.1 Preliminary Information

-

2.1.1 Identifiers

+

2.1.1 C++ Standard

+ +

The C++/Tree mapping provides support for ISO/IEC C++ 1998/2003 (C++98) + and ISO/IEC C++ 2011 (C++11). To select the C++ standard for the + generated code we use the --std XSD compiler command + line option. While the majority of the examples in this manual use + C++98, support for the new functionality and library components + introduced in C++11 are discussed throughout the document.

+ +

2.1.2 Identifiers

XML Schema names may happen to be reserved C++ keywords or contain characters that are illegal in C++ identifiers. To avoid C++ compilation @@ -563,7 +573,7 @@ CONVENTION section in the XSD Compiler Command Line Manual.

-

2.1.2 Character Type and Encoding

+

2.1.3 Character Type and Encoding

The code that implements the mapping, depending on the --char-type option, is generated using either @@ -588,7 +598,7 @@ encoding is UTF-16. On other platforms wchar_t is 4 bytes long and UTF-32/UCS-4 is used.

-

2.1.3 XML Schema Namespace

+

2.1.4 XML Schema Namespace

The mapping relies on some predefined types, classes, and functions that are logically defined in the XML Schema namespace reserved for @@ -605,7 +615,7 @@

-

2.1.4 Anonymous Types

+

2.1.5 Anonymous Types

For the purpose of code generation, anonymous types defined in XML Schema are automatically assigned names that are derived @@ -1132,9 +1142,10 @@ namespace system sequences of non-fundamental C++ types is the addition of the overloaded push_back and insert member functions which instead of the constant reference - to the element type accept automatic pointer to the element - type. These functions assume ownership of the pointed to - object and resets the passed automatic pointer. + to the element type accept automatic pointer (std::auto_ptr + or std::unique_ptr, depending on the C++ standard + selected) to the element type. These functions assume ownership + of the pointed to object and reset the passed automatic pointer.

2.5.1 Inheritance from Built-in Data Types

@@ -2317,9 +2328,10 @@ public: sequences of non-fundamental C++ types is the addition of the overloaded push_back and insert member functions which instead of the constant reference - to the element type accept automatic pointer to the element - type. These functions assume ownership of the pointed to - object and resets the passed automatic pointer. + to the element type accept automatic pointer (std::auto_ptr + or std::unique_ptr, depending on the C++ standard + selected) to the element type. These functions assume ownership + of the pointed to object and reset the passed automatic pointer.

2.6.4 Mapping for Derivation by Union

@@ -2384,10 +2396,11 @@ public: instance is initialized with copies of the passed objects. In the second constructor, arguments that are complex types (that is, they themselves contain elements or attributes) are passed as - references to std::auto_ptr. In this case the newly + either std::auto_ptr (C++98) or std::unique_ptr + (C++11), depending on the C++ standard selected. In this case the newly created instance is directly initialized with and assumes ownership - of the pointed to objects and the std::auto_ptr arguments - are reset to 0. For instance:

+ of the pointed to objects and the std::[auto|unique]_ptr + arguments are reset to 0. For instance:

 <complexType name="complex">
@@ -2432,7 +2445,7 @@ class object: xml_schema::type
 {
 public:
   object (const bool& s_one, const complex& c_one);
-  object (const bool& s_one, std::auto_ptr<complex>& c_one);
+  object (const bool& s_one, std::[auto|unique]_ptr<complex> c_one);
   object (const object&);
 
 public:
@@ -2449,7 +2462,7 @@ public:
   

Notice that the generated complex class does not - have the second (std::auto_ptr) version of the + have the second (std::[auto|unique]_ptr) version of the constructor since all its required members are of simple types.

If an XML Schema complex type has an ultimate base which is an XML @@ -2720,9 +2733,10 @@ public: constant of the member's type. It makes a deep copy of its argument. Except for member's types that are mapped to fundamental C++ types, the second modifier function is provided that expects an argument - of type automatic pointer to the member's type. It assumes ownership - of the pointed to object and resets the passed automatic pointer. - For instance:

+ of type automatic pointer (std::auto_ptr or + std::unique_ptr, depending on the C++ standard selected) + to the member's type. It assumes ownership of the pointed to object + and resets the passed automatic pointer. For instance:

 <complexType name="object">
@@ -2756,7 +2770,7 @@ public:
   member (const member_type&);
 
   void
-  member (std::auto_ptr<member_type>);
+  member (std::[auto|unique]_ptr<member_type>);
   ...
 
 };
@@ -2773,7 +2787,7 @@ class object: xml_schema::type
 public:
   ...
 
-  std::auto_ptr<member_type>
+  std::[auto|unique]_ptr<member_type>
   detach_member ();
   ...
 
@@ -2798,10 +2812,19 @@ f (object& o)
   o.member ("hello");           // set, deep copy
   o.member () = "hello";        // set, deep copy
 
+  // C++98 version.
+  //
   std::auto_ptr<string> p (new string ("hello"));
   o.member (p);                 // set, assumes ownership
   p = o.detach_member ();       // detach, member is uninitialized
   o.member (p);                 // re-attach
+
+  // C++11 version.
+  //
+  std::unique_ptr<string> p (new string ("hello"));
+  o.member (std::move (p));     // set, assumes ownership
+  p = o.detach_member ();       // detach, member is uninitialized
+  o.member (std::move (p));     // re-attach
 }
   
@@ -2831,11 +2854,12 @@ f (object& o) member's type. It makes a deep copy of its argument. Except for member's types that are mapped to fundamental C++ types, the second modifier function is provided that expects an argument - of type automatic pointer to the member's type. It assumes ownership - of the pointed to object and resets the passed automatic pointer. - The last modifier function expects an argument of type reference - to constant of the container type. It makes a deep copy of its - argument. For instance: + of type automatic pointer (std::auto_ptr or + std::unique_ptr, depending on the C++ standard selected) + to the member's type. It assumes ownership of the pointed to object + and resets the passed automatic pointer. The last modifier function + expects an argument of type reference to constant of the container + type. It makes a deep copy of its argument. For instance:

@@ -2871,7 +2895,7 @@ public:
   member (const member_type&);
 
   void
-  member (std::auto_ptr<member_type>);
+  member (std::[auto|unique]_ptr<member_type>);
 
   void
   member (const member_optional&);
@@ -2884,7 +2908,7 @@ public:
 
   

The optional class template is defined in an implementation-specific namespace and has the following - interface. The auto_ptr-based constructor + interface. The [auto|unique]_ptr-based constructor and modifier function are only available if the template argument is not a fundamental C++ type.

@@ -2904,7 +2928,7 @@ public: // Assumes ownership. // explicit - optional (std::auto_ptr<X>); + optional (std::[auto|unique]_ptr<X>); optional (const optional&); @@ -2953,11 +2977,11 @@ public: // Assumes ownership. // void - set (std::auto_ptr<X>); + set (std::[auto|unique]_ptr<X>); // Detach and return the contained value. // - std::auto_ptr<X> + std::[auto|unique]_ptr<X> detach (); void @@ -3016,6 +3040,8 @@ f (object& o) o.member ().reset (); // reset } + // C++98 version. + // std::auto_ptr<string> p (new string ("hello")); o.member (p); // set, assumes ownership @@ -3024,6 +3050,17 @@ f (object& o) p = o.member ().detach (); // detach, member is reset o.member ().set (p); // re-attach + + // C++11 version. + // + std::unique_ptr<string> p (new string ("hello")); + o.member (std::move (p)); // set, assumes ownership + + p.reset (new string ("hello")); + o.member ().set (std::move (p)); // set, assumes ownership + + p = o.member ().detach (); // detach, member is reset + o.member ().set (std::move (p)); // re-attach }
@@ -3104,9 +3141,11 @@ public: the overloaded push_back and insert as well as the detach_back and detach member functions. The additional push_back and - insert functions accept an automatic pointer to the + insert functions accept an automatic pointer + (std::auto_ptr or std::unique_ptr, + depending on the C++ standard selected) to the element type instead of the constant reference. They assume - ownership of the pointed to object and resets the passed + ownership of the pointed to object and reset the passed automatic pointer. The detach_back and detach functions detach the element value from the sequence container and, by default, remove @@ -3121,17 +3160,17 @@ public: ... void - push_back (std::auto_ptr<X>) + push_back (std::[auto|unique]_ptr<X>) iterator - insert (iterator position, std::auto_ptr<X>) + insert (iterator position, std::[auto|unique]_ptr<X>) - std::auto_ptr<X> + std::[auto|unique]_ptr<X> detach_back (bool pop = true); iterator detach (iterator position, - std::auto_ptr<X>& result, + std::[auto|unique]_ptr<X>& result, bool erase = true) ... @@ -3159,11 +3198,20 @@ f (object& o) // s.push_back ("hello"); // deep copy + // C++98 version. + // std::auto_ptr<string> p (new string ("hello")); s.push_back (p); // assumes ownership p = s.detach_back (); // detach and pop s.push_back (p); // re-append + // C++11 version. + // + std::unique_ptr<string> p (new string ("hello")); + s.push_back (std::move (p)); // assumes ownership + p = s.detach_back (); // detach and pop + s.push_back (std::move (p)); // re-append + // Setting a new container. // object::member_sequence n; @@ -3192,14 +3240,16 @@ f (object& o)

The parsing functions read XML instance documents and return - corresponding object models. Their signatures + corresponding object models as an automatic pointer + (std::auto_ptr or std::unique_ptr, + depending on the C++ standard selected). Their signatures have the following pattern (type denotes element's type and name denotes element's name):

-std::auto_ptr<type>
+std::[auto|unique]_ptr<type>
 name (....);
   
@@ -3207,9 +3257,8 @@ name (....); functions, is the subject of Chapter 3, "Parsing".

-

The serialization functions write object models - back to XML instance documents. Their signatures - have the following pattern: +

The serialization functions write object models back to XML instance + documents. Their signatures have the following pattern:

@@ -3272,13 +3321,13 @@ public:
   value (const value_type&);
 
   void
-  value (std::auto_ptr<value_type>);
+  value (std::[auto|unique]_ptr<value_type>);
 
   // Constructors.
   //
   root (const value_type&);
 
-  root (std::auto_ptr<value_type>);
+  root (std::[auto|unique]_ptr<value_type>);
 
   root (const xercesc::DOMElement&, xml_schema::flags = 0);
 
@@ -3374,7 +3423,7 @@ namespace xml_schema
   class element_map
   {
   public:
-    static std::auto_ptr<xml_schema::element_type>
+    static std::[auto|unique]_ptr<xml_schema::element_type>
     parse (const xercesc::DOMElement&, flags = 0);
 
     static void
@@ -3385,7 +3434,9 @@ namespace xml_schema
 
   

The parse() function creates the corresponding element type object based on the element name and namespace - and returns it as a pointer to xml_schema::element_type. + and returns it as an automatic pointer (std::auto_ptr + or std::unique_ptr, depending on the C++ standard + selected) to xml_schema::element_type. The serialize() function serializes the passed element object to DOMElement. Note that in case of serialize(), the DOMElement object @@ -4574,18 +4625,18 @@ f (object& o, const xercesc::DOMAttr& a) // Read from a URI or a local file. // -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (const std::basic_string<C>& uri, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (const std::basic_string<C>& uri, xml_schema::error_handler&, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (const std::basic_string<C>& uri, xercesc::DOMErrorHandler&, xml_schema::flags = 0, @@ -4595,38 +4646,38 @@ name (const std::basic_string<C>& uri, // Read from std::istream. // -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (std::istream&, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (std::istream&, xml_schema::error_handler&, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (std::istream&, xercesc::DOMErrorHandler&, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (std::istream&, const std::basic_string<C>& id, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (std::istream&, const std::basic_string<C>& id, xml_schema::error_handler&, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (std::istream&, const std::basic_string<C>& id, xercesc::DOMErrorHandler&, @@ -4637,18 +4688,18 @@ name (std::istream&, // Read from InputSource. // -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (xercesc::InputSource&, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (xercesc::InputSource&, xml_schema::error_handler&, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (xercesc::InputSource&, xercesc::DOMErrorHandler&, xml_schema::flags = 0, @@ -4658,13 +4709,13 @@ name (xercesc::InputSource&, // Read from DOM. // -std::auto_ptr<type> +std::[auto|unique]_ptr<type> name (const xercesc::DOMDocument&, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ()); -std::auto_ptr<type> -name (xml_schema::dom::auto_ptr<xercesc::DOMDocument>&, +std::[auto|unique]_ptr<type> +name (xml_schema::dom::[auto|unique]_ptr<xercesc::DOMDocument>, xml_schema::flags = 0, const xml_schema::properties& = xml_schema::properties ());

@@ -4672,8 +4723,11 @@ name (xml_schema::dom::auto_ptr<xercesc::DOMDocument>&,

You can choose between reading an XML instance from a local file, URI, std::istream, xercesc::InputSource, or a pre-parsed DOM instance in the form of - xercesc::DOMDocument. Each of these parsing functions - is discussed in more detail in the following sections. + xercesc::DOMDocument. All the parsing functions + return a dynamically allocated object model as either + std::auto_ptr or std::unique_ptr, + depending on the C++ standard selected. Each of these parsing + functions is discussed in more detail in the following sections.

3.1 Initializing the Xerces-C++ Runtime

@@ -4715,7 +4769,7 @@ name (xml_schema::dom::auto_ptr<xercesc::DOMDocument>&,
Assume ownership of the DOM document passed. This flag only makes sense together with the keep_dom flag in the call to the parsing function with the - xml_schema::dom::auto_ptr<DOMDocument> + xml_schema::dom::[auto|unique]_ptr<DOMDocument> argument.
xml_schema::flags::dont_validate
@@ -5171,6 +5225,15 @@ auto_ptr<type> r1 (name ("test.xml")); auto_ptr<type> r2 (name ("http://www.codesynthesis.com/test.xml"));
+

Or, in the C++11 mode:

+ +
+using std::unique_ptr;
+
+unique_ptr<type> r1 (name ("test.xml"));
+unique_ptr<type> r2 (name ("http://www.codesynthesis.com/test.xml"));
+  
+

3.5 Reading from std::istream

When using an std::istream instance, you may also @@ -5220,21 +5283,30 @@ std::auto_ptr<type> r (name (is));

The last parsing function is useful when you would like to perform your own XML-to-DOM parsing and associate the resulting DOM document - with the object model nodes. If parsing is successeful, the - automatic DOMDocument pointer is reset and the - resulting object model assumes ownership of the DOM document - passed. For example:

+ with the object model nodes. The automatic DOMDocument + pointer is reset and the resulting object model assumes ownership + of the DOM document passed. For example:

+// C++98 version.
+//
 xml_schema::dom::auto_ptr<xercesc::DOMDocument> doc = ...
 
 std::auto_ptr<type> r (
   name (doc, xml_schema::flags::keep_dom | xml_schema::flags::own_dom));
 
 // At this point doc is reset to 0.
-  
+// C++11 version. +// +xml_schema::dom::unique_ptr<xercesc::DOMDocument> doc = ... + +std::unique_ptr<type> r ( + name (std::move (doc), + xml_schema::flags::keep_dom | xml_schema::flags::own_dom)); +// At this point doc is reset to 0. +

4 Serialization

@@ -5321,7 +5393,7 @@ name (xercesc::XMLFormatTarget&, // Serialize to DOM. // -xml_schema::dom::auto_ptr<xercesc::DOMDocument> +xml_schema::dom::[auto|unique]_ptr<xercesc::DOMDocument> name (const type&, const xml_schema::namespace_infomap& xml_schema::namespace_infomap (), @@ -5800,10 +5872,10 @@ XMLPlatformUtils::Initialize (); { // Parse XML to object model. // - std::auto_ptr<type> r = root ( + std::auto_ptr<type> r (root ( "root.xml", xml_schema::flags::keep_dom | - xml_schema::flags::dont_initialize); + xml_schema::flags::dont_initialize)); // Copy without DOM association. // @@ -5847,10 +5919,10 @@ XMLPlatformUtils::Initialize (); { // Parse XML to object model. // - std::auto_ptr<type> r = root ( + std::auto_ptr<type> r (root ( "root.xml", xml_schema::flags::keep_dom | - xml_schema::flags::dont_initialize); + xml_schema::flags::dont_initialize)); DOMNode* n = root->_node (); assert (n->getNodeType () == DOMNode::ELEMENT_NODE); @@ -5938,7 +6010,7 @@ XMLPlatformUtils::Terminate ();
 // Parse XML to object model.
 //
-std::auto_ptr<type> r = root ("root.xml");
+std::auto_ptr<type> r (root ("root.xml"));
 
 // Save to a CDR stream.
 //
diff --git a/doc/cxx/tree/reference/libxsd.doxygen b/doc/cxx/tree/reference/libxsd.doxygen
index 3f524d1..376d34a 100644
--- a/doc/cxx/tree/reference/libxsd.doxygen
+++ b/doc/cxx/tree/reference/libxsd.doxygen
@@ -1042,13 +1042,13 @@ ENABLE_PREPROCESSING   = YES
 # compilation will be performed. Macro expansion can be done in a controlled 
 # way by setting EXPAND_ONLY_PREDEF to YES.
 
-MACRO_EXPANSION        = NO
+MACRO_EXPANSION        = YES
 
 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
 # then the macro expansion is limited to the macros specified with the 
 # PREDEFINED and EXPAND_AS_DEFINED tags.
 
-EXPAND_ONLY_PREDEF     = NO
+EXPAND_ONLY_PREDEF     = YES
 
 # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
 # in the INCLUDE_PATH (see below) will be search if a #include is found.
@@ -1076,7 +1076,13 @@ INCLUDE_FILE_PATTERNS  =
 # undefined via #undef or recursively expanded use the := operator 
 # instead of the = operator.
 
-PREDEFINED             = 
+# C++98 version.
+#
+PREDEFINED             = XSD_AUTO_PTR=std::auto_ptr
+
+# C++11 version.
+#
+# PREDEFINED             = XSD_AUTO_PTR=std::unique_ptr
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
 # this tag can be used to specify a list of macro names that should be expanded. 
-- 
cgit v1.1