Re: [boost] interest in properties library

Daniel Oberhoff wrote:
HasPropertiesBase<VariantTypes> * foo = new Foo; foo->set_property("a", 1); int a = get<int>( foo->get_property( "a" ) );
And I suppose if it's not an int, it throws? For proprieties, it might be better to provide lexical conversion to the target type, so that it always succeeds (modulo allocation errors).
Anyway, I'm not too sure this is very useful. It's just a std::map<std::string, some_variant_type>. Does that really deserve its own class?
well, this was the simpler case. by using variants and defining proper visitors conversions can be made automatically, like using lexical_cast, which is what I wanted to do soon (I alread do the simple conversions, just learned about lexical cast now). But the point of the lib is actually, that you don't need to know the type of the class, plus that you have arbitrary setter/getter methods. Also properties from classes along the inheritance graph get concatenated into a single interface. Daniel
participants (1)
-
Daniel Oberhoff