Implement copy constructor for class Monitor

To support the instance copy of Monitor like the following:
    AMQP::Monitor monitor(consumer);
    consumer->bindExchange(exchange, AMQP::direct).onSuccess([&, monitor](){
        // do something when the consumer is ready!
        if(monitor.valid())
            consumer->doSomething();
    });
This commit is contained in:
javeme 2016-07-17 00:38:43 +08:00
parent fe01610e96
commit 4b7874c5b6
1 changed files with 10 additions and 0 deletions

View File

@ -57,6 +57,16 @@ public:
_watchable->add(this);
}
/**
* Copy constructor
* @param monitor
*/
Monitor(const Monitor &monitor) : _watchable(monitor._watchable)
{
// register with the watchable
_watchable->add(this);
}
/**
* Destructor
*/