/ Vijos /

记录详情

Compile Error

foo.cpp: In function 'void input()':
foo.cpp:20:58: error: no match for 'operator-' (operand types are 'std::string {aka std::basic_string<char>}' and 'char')
  for (int i = 1; i<=n.len; i++) n.num[n.len - i + 1] = s - '0';
                                                          ^
foo.cpp:20:58: note: candidates are:
In file included from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algobase.h:67:0,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\char_traits.h:39,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\ios:40,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\ostream:38,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\iostream:39,
                 from foo.cpp:1:
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h:327:5: note: template<class _Iterator> typename std::reverse_iterator<_Iterator>::difference_type std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator-(const reverse_iterator<_Iterator>& __x,
     ^
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h:327:5: note:   template argument deduction/substitution failed:
foo.cpp:20:60: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
  for (int i = 1; i<=n.len; i++) n.num[n.len - i + 1] = s - '0';
                                                            ^
In file included from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algobase.h:67:0,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\char_traits.h:39,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\ios:40,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\ostream:38,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\iostream:39,
                 from foo.cpp:1:
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h:384:5: note: template<class _IteratorL, class _IteratorR> typename std::reverse_iterator<_Iterator>::difference_type std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator-(const reverse_iterator<_IteratorL>& __x,
     ^
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h:384:5: note:   template argument deduction/substitution failed:
foo.cpp:20:60: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const std::reverse_iterator<_Iterator>'
  for (int i = 1; i<=n.len; i++) n.num[n.len - i + 1] = s - '0';
                                                            ^
In file included from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algobase.h:67:0,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\char_traits.h:39,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\ios:40,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\ostream:38,
                 from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\iostream:39,
                 from foo.cpp:1:
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h:896:5: note: template<class _Iterator, class _Container> typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
     operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
     ^
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h:896:5: note:   template argument deduction/substitution failed:
foo.cpp:20:60: note:   'std::string {aka std::basic_string<char>}' is not derived from 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>'
  for (int i = 1; i<=n.len; i++) n.num[n.len - i + 1] = s - '0';
                                                            ^
In file included from c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\includ

信息

递交者
类型
递交
题目
P1032 循环
语言
C++
递交时间
2014-09-27 20:05:51
评测时间
2014-09-27 20:05:52
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes