diff --git a/examples/demo.cpp b/examples/demo.cpp new file mode 100644 index 0000000..84201a4 --- /dev/null +++ b/examples/demo.cpp @@ -0,0 +1,35 @@ +#include "settable.hpp" + +#include + +#include + +namespace settable { + namespace setter { + namespace string2type { + namespace helper { + template<> + int convert(const std::string &value) { + return boost::lexical_cast(value); + } + } + } + } +} + +struct foo : settable::settable { + foo() { + register_setter("x", &x); + } + + int x; +}; + +int main(int argc, char *argv) { + foo f; + f.set_attribute("x", "42"); + + std::cout << f.x << std::endl; + + return 0; +} \ No newline at end of file