运行 ID: 78448

Main.cc: In function ‘std::__cxx11::string subtract(const string&, const string&)’:
Main.cc:9:23: error: no matching function for call to ‘swap(const string&, const string&)’
         std::swap(a, b);
                       ^
In file included from /usr/include/c++/7/bits/nested_exception.h:40:0,
                 from /usr/include/c++/7/exception:143,
                 from /usr/include/c++/7/ios:39,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from Main.cc:1:
/usr/include/c++/7/bits/move.h:187:5: note: candidate: template typename std::enable_if >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&)
     swap(_Tp& __a, _Tp& __b)
     ^~~~
/usr/include/c++/7/bits/move.h:187:5: note:   template argument deduction/substitution failed:
/usr/include/c++/7/bits/move.h: In substitution of ‘template typename std::enable_if >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> >::value>::type std::swap(_Tp&, _Tp&) [with _Tp = const std::__cxx11::basic_string]’:
Main.cc:9:23:   required from here
/usr/include/c++/7/bits/move.h:187:5: error: no type named ‘type’ in ‘struct std::enable_if’
/usr/include/c++/7/bits/move.h:210:5: note: candidate: template typename std::enable_if::value>::type std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
     ^~~~
/usr/include/c++/7/bits/move.h:210:5: note:   template argument deduction/substitution failed:
Main.cc:9:23: note:   mismatched types ‘_Tp [_Nm]’ and ‘const string {aka const std::__cxx11::basic_string}’
         std::swap(a, b);
                       ^
In file included from /usr/include/c++/7/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/7/bits/char_traits.h:39,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from Main.cc:1:
/usr/include/c++/7/bits/stl_pair.h:495:5: note: candidate: template void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)
     swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
     ^~~~
/usr/include/c++/7/bits/stl_pair.h:495:5: note:   template argument deduction/substitution failed:
Main.cc:9:23: note:   types ‘std::pair<_T1, _T2>’ and ‘const string {aka const std::__cxx11::basic_string}’ have incompatible cv-qualifiers
         std::swap(a, b);
                       ^
In file included from /usr/include/c++/7/string:52:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from Main.cc:1:
/usr/include/c++/7/bits/basic_string.h:6246:5: note: candidate: template void std::swap(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)
     swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^~~~
/usr/include/c++/7/bits/basic_string.h:6246:5: note:   template argument deduction/substitution failed:
Main.cc:9:23: note:   types ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘const string {aka const std::__cxx11::basic_string}’ have incompatible cv-qualifiers
         std::swap(a, b);
                       ^