各位帮忙看下list里的这个问题
list<unsigned int> bits;
list<unsigned int>::iterator k;
k=bits.begin();
把bits.begin();赋给k就有问题,请问是为啥?
g++ -O0 -I../include -I../ui -I../system -c nav_view.cpp nav_view.h
nav_view.cpp: 在成员函数‘int nav_view::hide()’中:
nav_view.cpp:78:15: 错误: ‘operator=’在‘k = ((nav_view*)this)->nav_view::bits.std::list<_Tp, _Alloc>::begin<short unsigned int, std::allocator<short unsigned int> >()’中没有匹配
nav_view.cpp:78:15: 附注: 备选是:
In file included from /usr/include/c++/4.7/list:64:0,
from nav_view.h:4,
from nav_view.cpp:1:
/usr/include/c++/4.7/bits/stl_list.h:126:12: 附注: std::_List_iterator<unsigned int>& std::_List_iterator<unsigned int>::operator=(const std::_List_iterator<unsigned int>&)
/usr/include/c++/4.7/bits/stl_list.h:126:12: 附注: no known conversion for argument 1 from ‘std::list<short unsigned int>::iterator {aka std::_List_iterator<short unsigned int>}’ to ‘const std::_List_iterator<unsigned int>&’
make: *** [all] 错误 1
[解决办法]
bits的模板参数是short unsigned int类型,k的模板参数是unsigned int类型,不匹配。查一下你的上下文。
这时就看出C++11的auto的好处了。
[解决办法]
没有定义COLOR32,用的 list<unsigned short>::iterator k; 头文件声明的nav_view.h里定义ist<unsigned int> bits;不匹配吧
[解决办法]
明显这里还有宏没有处理。
[解决办法]
宏没定义,或者没有包含含有定义的头文件,或者某些地方有undef宏等