
On Tue, 12 May 2009 17:25:54 -0700, Chris Meyer <cmeyer1969+boost@gmail.com> wrote:
Perhaps there should be a templatized member function which uses the translator to automatically iterate all values of a particular key and have it converted to the desired data type.
Then I could use something like:
BOOST_FOREACH(MyType myvar, pt.get_all<MyType>(key)) { doSomething(myvar); }
Is this possible? Or is there something I'm missing from the existing API that allows me to do this?
Nothing in the existing API, although it is possible. However, I feel that this would be more suited for a generic iterator/range adaptor library instead of being embedded in the core interface. The new RangeEx library, I believe, should help you there. You can take the full range of children (actually, I plan to add iteration over the children with a given key), filter on the key, then add a transform iterator that extracts and converts the value. Sebastian