I have a Track class with a multimap member that contains Note objects. One of the methods of the Note class is this:
float Note::getValue(){
    float sample = generator->getSample(this); // not working
    return sample;
}
Note also has a member of Generator type and I need to call the getSample method of that class, which expects a Note as argument. I need to pass the current Note object and tried doing so with the keyword this but that's not working and giving me the error Non-const lvalue reference to type 'Note' cannot bind to a temporary of type 'Note *'.
This is what the method definition for getSample looks like:
virtual float getSample(Note ¬e);
As you can see I'm using a reference because this method is called very very often and I can't afford to copy the object. So my question is: any ideas how I can get this done? Or maybe change my model to something that could work?
EDIT
I forgot to mention that I also had tried using generator->getSample(*this); but this wasn't working either. I'm getting this error message:
Undefined symbols for architecture i386:
  "typeinfo for Generator", referenced from:
      typeinfo for Synth in Synth.o
  "vtable for Generator", referenced from:
      Generator::Generator(Generator const&) in InstrumentGridViewController.o
      Generator::Generator() in Synth.o
      Generator::Generator(Generator const&) in InstrumentGridViewController.o
      Generator::Generator() in Synth.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is what my Generator class looks like (the getSample method is implemented in a subclass):
class Generator{
public:
    virtual float getSample(Note ¬e);
};
 
     
     
    