
Hi, I am rather beginner at boost - I am trying to achieve functionality similiar to property getter/setter from managed languages like C#. I have written the following code: #include "boost\lambda\bind.hpp" #include "boost\variant.hpp" #include "boost\optional.hpp" #include <iostream> #include <map> class Test { public: boost::optional<boost::variant<int, std::string>> m_value; }; int _tmain(int argc, _TCHAR* argv[]) { Test t1, t2; auto b1 = boost::lambda::bind(&Test::m_value, boost::lambda::_1); auto b2 = boost::lambda::bind(Test::m_value::get_value_or, boost::lambda::_1, "empty"); b1(t1) = "Test value"; std::cout << b2(t1); // "Test value" std::cout << b2(t2); // Should be "empty" return 0; } Unfortunately the compilers says: boost_tests.cpp(32): error C3083: 'm_value': the symbol to the left of a '::' must be a type boost_tests.cpp(32): error C2039: 'get_value_or' : is not a member of 'Test' boost_tests.cpp(22) : see declaration of 'Test' boost_tests.cpp(32): error C2065: 'get_value_or' : undeclared identifier boost_tests.cpp(32): fatal error C1903: unable to recover from previous error(s); stopping compilation I'd like to create a bind to Test::m_value.get_value_or() function with the first parameter set to "empty" - any ideas how to achieve that? Regards, Konrad.