Rust for C++

Observer

Rust
trait Listener {
    fn callback(&self);
}

struct Processor<'a> {
    listeners: Vec<&'a Listener>
}

Run

C++
struct Listener {
  virtual void callback() = 0;
};

struct Processor {
  vector<Listener*> listeners;
};

Run