Passing reference of current object as a parameter

I am trying to pass the reference of the current object as a parameter but cannot seem to find the proper syntax. Anyone got any idea?
*this
For some reason I cannot get this to work. I've pasted the relevant code and error message.

The call to the function is as follows

 
loop.initializeLoop(parent,child,matrix_p,interpreter_p,residues_p,*this);


1
2
3
4
5
6
7
class Loop {

private:

public:
void intializeLoop(int,int,Martix*,Interpreter*,std::vector<Node*>*,Network*);
};


I get the following error.
1
2
3
error: no matching function for call to ‘Loop::initializeLoop(int&, int&, Matrix*&, Interpreter*&, std::vector<Node*, std::allocator<Node*> >*&, Network&)’

note: candidates are: void Loop::initializeLoop(int, int, Matrix*, Interpreter*, std::vector<Node*, std::allocator<Node*> >*, Network*)
intializeLoop takes a pointer, not a reference.
Yes but I need to store the reference of the address of the current instance of Network in that pointer.

I am certain that my declaration of initializeLoop take the correct parameters for my needs. How do I pass the pointer then? I've tried omitting the * as well, it does not work.
Yes but I need to store the reference of the address of the current instance of Network in that pointer.

No, if anything, you need to store the address of the current instance in that pointer.

How do I pass the pointer then?
this is a pointer to the current instance.
As I said, omitting the * did not solve my problem. It generates the following error.

1
2
3
4
5
Undefined symbols for architecture x86_64:
  "Loop::initializeLoop(int, int, Matrix*, Interpreter*, std::vector<Node*, std::allocator<Node*> >*, Network*)", referenced from:
      Network::beginLoopRemoval(int, int)in ccLHsxdE.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Correction, it does work, I had accidentally included loop.cpp within a comment block.

I appreciate the help. Thank you.
Topic archived. No new replies allowed.