/ Vijos /

记录详情

Compile Error

foo.cpp: In function 'int cmp(const void*, const void*)':
foo.cpp:7:16: error: invalid use of 'const void'
       return x-y;
                ^
foo.cpp:6:9: warning: unused variable 'a' [-Wunused-variable]
     int a =*(int *)x,b=*(int *)y;
         ^
foo.cpp:6:22: warning: unused variable 'b' [-Wunused-variable]
     int a =*(int *)x,b=*(int *)y;
                      ^
In file included from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\algorithm:62:0,
                 from foo.cpp:2:
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = int (*)(const void*, const void*)]':
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:2250:70:   required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = int (*)(const void*, const void*)]'
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:5514:55:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int*; _Compare = int (*)(const void*, const void*)]'
foo.cpp:15:19:   required from here
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:2183:29: error: invalid conversion from 'int' to 'const void*' [-fpermissive]
    if (__comp(*__i, *__first))
                             ^
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:2183:29: error: invalid conversion from 'int' to 'const void*' [-fpermissive]
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h: In instantiation of 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = int (*)(const void*, const void*)]':
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:5363:59:   required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter, _Compare) [with _RAIter = int*; _Compare = int (*)(const void*, const void*)]'
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:2355:68:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int*; _Size = int; _Compare = int (*)(const void*, const void*)]'
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:5513:44:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int*; _Compare = int (*)(const void*, const void*)]'
foo.cpp:15:19:   required from here
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:1972:27: error: invalid conversion from 'int' to 'const void*' [-fpermissive]
  if (__comp(*__i, *__first))
                           ^
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:1972:27: error: invalid conversion from 'int' to 'const void*' [-fpermissive]
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h: In instantiation of 'void std::__move_median_first(_Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = int*; _Compare = int (*)(const void*, const void*)]':
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:2318:68:   required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int*; _Compare = int (*)(const void*, const void*)]'
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:2360:62:   required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int*; _Size = int; _Compare = int (*)(const void*, const void*)]'
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:5513:44:   required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int*; _Compare = int (*)(const void*, const void*)]'
foo.cpp:15:19:   required from here
c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_algo.h:110:28: error: invalid conversion from 'int' to 'const void*' [-fpermissive]
       if (__comp(*__a, *__b))

信息

递交者
类型
递交
题目
P1097 合并果子
语言
C++
递交时间
2016-11-18 22:13:09
评测时间
2016-11-18 22:13:34
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes