Boost logo

Boost :

Subject: Re: [boost] [GSOC] XML library of Boost
From: Martin Desharnais (martin.desharnais_at_[hidden])
Date: 2013-04-29 17:33:59


2013/4/29 Marshall Clow <mclow.lists_at_[hidden]>

>
> A "C++ interface", in my opinion, uses the same principles/concepts as the
> standard library.
>
> As opposed to, say, looking like Java or Python.
>

I think that value semantics should be consider for XML elements, as
opposed to most other libraries. Now that we have move semantic, it should
be possible to get good performance and it would "use the same principles"
as the standard library containers.

How about something like that?

xml::element root("root");
root.push_back(xml::comment("Comment"));
root.push_back(xml::element("Element"));
root.push_back(xml::text("Text"));
root.push_back(root);

Since xml::element have value semantic, it's current state will be copied
and appended to itself, resulting in the following structure:

<root>
   <!-- Comment -->
   <Element />
   Text
   <root>
      <!-- Comment -->
      <Element />
      Text
   </root>
</root>

-- 
Martin Desharnais

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk