Boost logo

Boost Users :

Subject: Re: [Boost-users] Bind to a member's class method.
From: Adam Romanek (romanek.adam_at_[hidden])
Date: 2014-03-21 07:08:17


On 03/21/2014 12:00 PM, Konrad Rybacki wrote:
> class Test
> {
> public:
> boost::optional<boost::variant<int, std::string>> m_value;
> };

Seems to me that you need to refer to the type of the member variable,
not the actual instance, so:

class Test
{
public:
     typedef boost::optional<boost::variant<int, std::string>> Value;
     Value m_value;
};

auto b2 = boost::lambda::bind(Test::Value::get_value_or,
boost::lambda::_1, "empty");

WBR,
Adam Romanek


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net