
Douglas Gregor wrote:
Have you perchance looked at Xpressive? The static constructs in it allow static checking of regexes (because they are built with C++ operators), whereas the dynamic (from-string) constructs allow one more flexibility. The same can occur with XPath: using some C++ operator overloading, we can have statically-checked XPath expressions that also provide more accurate type information (e.g., an element-set instead of a node-set). Of course, we'll always need to be able to fall back to strings as XPath expressions, which can only be checked at run-time.
I totally agree. And yes, it would be nice if the xpath sub-type could be used to narrow down the result type, i.e. attribute_set instead of node_set, etc. Regards, Stefan