I need access to a list of a class called neuron passed in a function. The problem is this function is part of the neuron class itself. When I try to access the passed neuron with an iterator I get a compile error. Im not sure if this is recursion (in which case the post title is wrong). If the problem is because the class is trying to access itself before it's fully defined then is there any way around it?
Code:
class neuron {
public:
//..
deque<dend> dends; //class with 3 int variables
//..
short calcExcitation(const list<neuron> &ln) {
float total=0;
neuron searchNeuron;
list<neuron>::iterator iter;
for(int i=0;i<dends.size();i++) {
searchNeuron.neuronID=dends[i].ID;
iter=find(ln.begin(), ln.end(), searchNeuron); //error here
if(iter!=ln.end())
total+=dends[i].weight * (*iter).excitation;
}
return excitation=total>ExcWeightThr?1:0;
}
};
list<neuron> baseNeuron; //global variable
The error I get is:
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::list<_Ty,_Ax>::const_iterator' (or there is no acceptable conversion)
with
[
_Ty=neuron,
_Ax=std::allocator<neuron>
]