Advertisement

register vector explicit copy contructor problem

Started by February 19, 2009 05:43 PM
1 comment, last by dxj19831029 15 years, 9 months ago
Hi, I got this problem when registering using stdvector.h add-on. The declearion of the class:

class ComboboxScript {
public:
	ComboboxScript();
	ComboboxScript(ComboboxScript& );
};
The error msg:

c:\program files\microsoft visual studio 9.0\vc\include\vector(1209) : error C2558: class 'ComboboxScript' : no copy constructor available or copy constructor is declared 'explicit'
1>        c:\program files\microsoft visual studio 9.0\vc\include\vector(1158) : while compiling class template member function 'void std::vector<_Ty>::_Insert_n(std::_Vector_const_iterator<_Ty,_Alloc>,unsigned int,const _Ty &)'
1>        with
1>        [
1>            _Ty=ComboboxScript,
1>            _Alloc=std::allocator<ComboboxScript>
1>        ]
1>        c:\work\xijing2\scriptengine.cpp(2523) : see reference to class template instantiation 'std::vector<_Ty>' being compiled
1>        with
1>        [
1>            _Ty=ComboboxScript
1>        ]
1>c:\program files\microsoft visual studio 9.0\vc\include\vector(1233) : error C2558: class 'ComboboxScript' : no copy constructor available or copy constructor is declared 'explicit'
Why do I get this explicit problem? I had another class with a very similar declearion as well, it did not get error. Can anyone explain to me?
You probably actually want:
ComboboxScript(const ComboboxScript& );
Advertisement
Em.. yeah, you are rite. I did not realise its the const problem.
So stupid.

:)

Quote: Original post by SiCrane
You probably actually want:
ComboboxScript(const ComboboxScript& );

This topic is closed to new replies.

Advertisement