Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:11:41: error: cannot bind rvalue reference of type 'char&&' to lvalue of type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   11 |         if(!m.count(make_pair<char,char>(x[0],x[1]))){
      |                     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/12/bits/stl_algobase.h:64,
                 from /usr/include/c++/12/string:50,
                 from /usr/include/c++/12/bits/locale_classes.h:40,
                 from /usr/include/c++/12/bits/ios_base.h:41,
                 from /usr/include/c++/12/ios:42,
                 from /usr/include/c++/12/istream:38,
                 from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/complex:45,
                 from /usr/include/c++/12/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:54,
                 from /in/foo.cc:1:
/usr/include/c++/12/bits/stl_pair.h:741:21: note:   initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = char; _T2 = char; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = char; typename decay<_Tp2>::type = char; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = char; typename decay<_Tp>::type = char]'
  741 |     make_pair(_T1&& __x, _T2&& __y)
      |               ~~~~~~^~~
/in/foo.cc:12:35: error: cannot bind rvalue reference of type 'char&&' to lvalue of type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   12 |             m[make_pair<char,char>(x[0],x[1])]=1;
      |               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/usr/include/c++/12/bits/stl_pair.h:741:21: note:   initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = char; _T2 = char; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = char; typename decay<_Tp2>::type = char; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = char; typename decay<_Tp>::type = char]'
  741 |     make_pair(_T1&& __x, _T2&& __y)
      |               ~~~~~~^~~

信息

递交者
类型
递交
题目
P1000 大象喝水
语言
C++
递交时间
2025-06-04 20:44:50
评测时间
2025-06-04 20:44:50
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes