vector 的 rbegin()小问题
std::vector<std::string>myList;std::vector<std::string>::const_iteratorrIter=myList.b...
std::vector<std::string> myList;
std::vector<std::string>::const_iterator rIter = myList.begin(); // ok
std::vector<std::string>::const_iterator rIter = myList.rbegin(); // error
// 错误信息是Description Resource Path Location Type
conversion from ‘std::vector<std::basic_string<char> >::reverse_iterator {aka std::reverse_iterator<__gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > > >}’ to non-scalar type ‘std::vector<std::basic_string<char> >::const_iterator {aka __gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >}’ requested read.cpp /read line 26 C/C++ Problem
为什么rbegin()就不可以了?? 展开
std::vector<std::string>::const_iterator rIter = myList.begin(); // ok
std::vector<std::string>::const_iterator rIter = myList.rbegin(); // error
// 错误信息是Description Resource Path Location Type
conversion from ‘std::vector<std::basic_string<char> >::reverse_iterator {aka std::reverse_iterator<__gnu_cxx::__normal_iterator<std::basic_string<char>*, std::vector<std::basic_string<char> > > >}’ to non-scalar type ‘std::vector<std::basic_string<char> >::const_iterator {aka __gnu_cxx::__normal_iterator<const std::basic_string<char>*, std::vector<std::basic_string<char> > >}’ requested read.cpp /read line 26 C/C++ Problem
为什么rbegin()就不可以了?? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询