error C2582: 'operator =' function is unavailable in 'EDIN::Neuron'

I have a class called "Neuron" for which I do not have a copy constructor, as I don't want to copy it. However, when I try to compile my code I get this long pile of errors from VS2012:

1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2466): error C2582: 'operator =' function is unavailable in 'EDIN::Neuron'
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(2487) : see reference to function template instantiation '_OutIt std::_Move<_InIt,_OutIt>(_InIt,_InIt,_OutIt,std::_Nonscalar_ptr_iterator_tag)' being compiled
1>          with
1>          [
1>              _OutIt=EDIN::Neuron *,
1>              _InIt=EDIN::Neuron *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector(1397) : see reference to function template instantiation '_OutIt std::_Move<EDIN::Neuron*,EDIN::Neuron*>(_InIt,_InIt,_OutIt)' being compiled
1>          with
1>          [
1>              _OutIt=EDIN::Neuron *,
1>              _InIt=EDIN::Neuron *
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector(1381) : while compiling class template member function 'std::_Vector_iterator<_Myvec> std::vector<_Ty>::erase(std::_Vector_const_iterator<_Myvec>,std::_Vector_const_iterator<_Myvec>)'
1>          with
1>          [
1>              _Myvec=std::_Vector_val<std::_Simple_types<EDIN::Neuron>>,
1>              _Ty=EDIN::Neuron
1>          ]
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\vector(1061) : see reference to function template instantiation 'std::_Vector_iterator<_Myvec> std::vector<_Ty>::erase(std::_Vector_const_iterator<_Myvec>,std::_Vector_const_iterator<_Myvec>)' being compiled
1>          with
1>          [
1>              _Myvec=std::_Vector_val<std::_Simple_types<EDIN::Neuron>>,
1>              _Ty=EDIN::Neuron
1>          ]
1>          c:\users\usr\google drive\code\edin\class_brain.h(14) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1>          with
1>          [
1>              _Ty=EDIN::Neuron
1>          ]


class_brain.h looks like this (I've trimmed it to show where the error occurs:

1
2
3
4
5
6
7
8
9
class Brain
{
public:
	Brain(std::vector<Codon> const&); // construct the brain from a brain codon sequence (ostensibly from a brain gene)

//  ...some methods go here...
private:
	std::vector<Neuron> neuron_sequence;// ERROR
};


Why is the header causing this error when I don't want to copy anything, and even if I was doing it inadvertently surely there's no copying going on in the declaration of a vector?
Last edited on
Class EDIN::Neuron has no an acceptable copy assignment operator that is required for member function erase of class std::vector<Synapse>.

Sorry there was a mistake (the code snippet was from the wrong class). It's been corrected.
But I don't make any calls to neuron_sequence.erase() anywhere in my program...
I make a call to resize(), could that be it? If so, why?
Member function resize calls member function erase if the new size is less than the current size of the vector.
Topic archived. No new replies allowed.