qt - C++ doesn't compile my custom data type including a vector in it -


i tried custom list, has intern private vector.

yet allways error-message, , have no idea start problem. use qt, windows , "config += c++11" within project.

...mypath\c++\bits\stl_construct.h:75: error: call of overloaded 'mydatatype()' ambiguous      { ::new(static_cast<void*>(__p)) _t1(std::forward<_args>(__args)...); }    ^ 

what errormessage tries tell me here? should start look?

thanks hint.

edit: constructors lists:

/*********************************************************************** * constructors , destructor * *********************************************************************/ datatype_collection::datatype_collection(){     std::vector<datatype> erg (0);     m_datatype_list = erg; }  datatype_collection::~datatype_collection(){ } 

for datatype:

/*********************************************************************** * constructors , destructor - implemented because of rule of 3 * *********************************************************************/ datatype::datatype(float value)     : m_datatype( to_datatype(value) ){ }  datatype::datatype(int32_t value)     : m_datatype(value){ }  fix_point::~fix_point(){ } 

edit2: there lot of more text, isn't directly marked error:

...\mingw482_32\i686-w64-mingw32\include\c++\vector:62: in file included   .../mingw482_32/i686-w64-mingw32/include/c++/vector:62:0,  ...\qtcreator\bin\myfolder\datatype_collection.h:25: ..\myfolder\datatype_collection.h:25,  ...\qtcreator\bin\myfolder\datatype_collection.cpp:1: ..\myfolder\datatype_collection.cpp:1:  ...\mingw482_32\i686-w64-mingw32\include\c++\bits\stl_construct.h:-1: in instantiation of 'void std::_construct(_t1*, _args&& ...) [with _t1 = fix_point; _args = {}]':  ...\mingw482_32\i686-w64-mingw32\include\c++\bits\stl_uninitialized.h:495: required 'static void std::__uninitialized_default_n_1<_trivialvaluetype>::__uninit_default_n(_forwarditerator, _size) [with _forwarditerator = fix_point*; _size = unsigned int; bool _trivialvaluetype = false]'  ...\mingw482_32\i686-w64-mingw32\include\c++\bits\stl_uninitialized.h:544: required 'void std::__uninitialized_default_n(_forwarditerator, _size) [with _forwarditerator = fix_point*; _size = unsigned int]'  ...\mingw482_32\i686-w64-mingw32\include\c++\bits\stl_uninitialized.h:605: required 'void std::__uninitialized_default_n_a(_forwarditerator, _size, std::allocator<_tp>&) [with _forwarditerator = fix_point*; _size = unsigned int; _tp = fix_point]'  ...\mingw482_32\i686-w64-mingw32\include\c++\bits\stl_vector.h:1225: required 'void std::vector<_tp, _alloc>::_m_default_initialize(std::vector<_tp, _alloc>::size_type) [with _tp = fix_point; _alloc = std::allocator<fix_point>; std::vector<_tp, _alloc>::size_type = unsigned int]'  ...\mingw482_32\i686-w64-mingw32\include\c++\bits\stl_vector.h:271: required 'std::vector<_tp, _alloc>::vector(std::vector<_tp, _alloc>::size_type, const allocator_type&) [with _tp = fix_point; _alloc = std::allocator<fix_point>; std::vector<_tp, _alloc>::size_type = unsigned int; std::vector<_tp, _alloc>::allocator_type = std::allocator<fix_point>]'  ...\qtcreator\bin\aufgabe2punkt1\datatype_collection.cpp:8: required here  ...\mingw482_32\i686-w64-mingw32\include\c++\bits\stl_construct.h:75: error: call of overloaded 'datatype()' ambiguous      { ::new(static_cast<void*>(__p)) _t1(std::forward<_args>(__args)...); }        ^  ...\mingw482_32\i686-w64-mingw32\include\c++\bits\stl_construct.h:75: candidates are:  ...\qtcreator\bin\myfolder\datatype_collection.h:24: in file included ..\myfolder\datatype_collection.h:24:0,  ...\qtcreator\bin\myfolder\datatype_collection.cpp:1: ..\myfolder\datatype_collection.cpp:1:  ...\qtcreator\bin\myfolder\datatype.hpp:48: datatype::datatype(int32_t)      datatype(int32_t value=0);         //constructor default value  ...\qtcreator\bin\myfolder\fixpoint.hpp:47: datatype::datatype(float)      datatype(float value=0);           //constructor default value      ^ 

update: found causes trouble, have no idea why causes problems:

/****************************************************************  * overloading of []-operator  * *************************************************************/ const datatype& datatype_collection::operator[](int value) const{ //read-only      return m_datatype_list[value]; } 

this method causes error seen above.

solved hi-angel:

the problem have 2 constructors default values. call datatype() @ line 8 ambiguous: 1 should chosen? far know, couldn't resolve exception of removing 1 of default values.

disclaimer: extracted question , posted here on op's behalf.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -