
On 04/09/2010 11:14 AM, Larry Evans wrote:
On 04/08/10 12:58, Stefan Seefeld wrote: [snip]
For the boost.xml library I'm working on I plan to use something akin to boost.variant as the return type of an xpath query.
What does boost.variant lack that leads you to create something akin to it?
Sorry, I'm not a native English speaker. By "akin to" I didn't mean to imply that it necessarily is something else. Just that boost.variant looks functionally like what I want, but that I haven't fully made up my mind about what the best interface is for this.
I don't think that the XPath specification should dictate a type hierarchy on a C++ implementation.
What is there about the XPath specification that makes any type hierarchy for modelling it less suitable than using something akin to boost.variant?
XPath queries may yield very different results, from mere integral numbers ("count(...)") to node-sets. I don't think it is meaningful or even possible to capture all those types in a single hierarchy (at least if by "hierarchy" we mean a common base class).
You see, I'm wondering because using type hierarchies and virtual functions has been touted as a great advantage of OO programming; yet, it apparently lacks something which you need.
Indeed. Not everything can be captured with OO. Especially if you take that to the extreme of a single-rooted type hierarchy. Stefan -- ...ich hab' noch einen Koffer in Berlin...