Record Detail

Compile Error

In file included from /in/driver/main.cpp:4:0:
/in/sort.hpp: In instantiation of 'void bubble_sort(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]':
/in/driver/main.cpp:131:45:   required from here
/in/sort.hpp:11:32: error: conversion to 'int' from 'std::vector<node>::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
     for (int i = vector.size() - 1; i > 0; i--) // i = N - 2 to 0
/in/sort.hpp:13:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         for (int j = 0; j < vector.size(); j++) // N - 1 pairs to compare
/in/sort.hpp:15:27: error: no match for 'operator>' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}' and '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}')
             if (vector[j] > vector[j+1]) // swap if element is larger than the next one
                 ~~~~~~~~~~^~~~~~~~~
/in/sort.hpp:9:70: error: unused parameter 'comp' [-Werror=unused-parameter]
 void bubble_sort(std::vector<T> &vector, Compare comp = std::less<T>()) {
                                                                      ^
/in/sort.hpp: In instantiation of 'void insertion_sort(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]':
/in/driver/main.cpp:135:48:   required from here
/in/sort.hpp:27:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 1; i < vector.size(); i++) // i = 1 to N - 1
/in/sort.hpp:31:36: error: no match for 'operator>' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}' and 'node')
         while (j >= 0 && vector[j] > temp) // if left of temp is greater
                          ~~~~~~~~~~^~~~~~
/in/sort.hpp:24:73: error: unused parameter 'comp' [-Werror=unused-parameter]
 void insertion_sort(std::vector<T> &vector, Compare comp = std::less<T>()) {
                                                                         ^
/in/sort.hpp: In instantiation of 'void selection_sort(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]':
/in/driver/main.cpp:139:48:   required from here
/in/sort.hpp:43:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < vector.size() - 1; i++) // i = 0 to N - 2
                     ~~^~~~~~~~~~~~~~~~~~~
/in/sort.hpp:46:31: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         for (int j = i + 1; j < vector.size(); j++)
/in/sort.hpp:48:27: error: no match for 'operator<' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}' and '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}')
             if (vector[j] < vector[smallest])
                 ~~~~~~~~~~^~~~~~~~~
/in/sort.hpp:41:73: error: unused parameter 'comp' [-Werror=unused-parameter]
 void selection_sort(std::vector<T> &vector, Compare comp = std::less<T>()) {
                                                                         ^
/in/sort.hpp: In instantiation of 'void merge_sort(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]':
/in/driver/main.cpp:143:44:   required from here
/in/sort.hpp:120:9: error: conversion to 'int' from 'std::vector<node>::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
     int n = vector.size();
         ^
/in/sort.hpp:118:69: error: unused parameter 'comp' [-Werror=unused-parameter]
 void merge_sort(std::vector<T> &vector, Compare comp = std::less<T>()) {
                                                                     ^
/in/sort.hpp: In instantiation of 'void quick_sort_extra(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]':
/in/driver/main.cpp:147:50:   required from here
/in/sort.hpp:167:9: error: conversion to 'int' from 'std::vector<node>::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
     int n = vector.size();
         ^
/in/sort.hpp:165:75: error: unused parameter 'comp' [-Werror=unused-parameter]
 void quick_sort_extra(std::vector<T> &vector, Compare comp = std::less<T>()) {
                                                                           ^
/in/sort.hpp: In instantiation of 'void quick_sort_inplace(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]':
/in/driver/main.cpp:151:52:   required from here
/in/sort.hpp:206:18: error: conversion to 'unsigned int' from 'std::vector<node>::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
     unsigned int n = vector.size();
                  ^
/in/sort.hpp:204:77: error: unused parameter 'comp' [-Werror=unused-parameter]
 void quick_sort_inplace(std::vector<T> &vector, Compare comp = std::less<T>()) {
                                                                             ^
/in/sort.hpp: In instantiation of 'void quick_sort_extra_helper(std::vector<T>&, int, int) [with T = node]':
/in/sort.hpp:169:28:   required from 'void quick_sort_extra(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]'
/in/driver/main.cpp:147:50:   required from here
/in/sort.hpp:130:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         for (int i = 0; i < B.size(); i++)
/in/sort.hpp:140:27: error: no match for 'operator<' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}' and 'node')
             if (vector[i] < pivot)
                 ~~~~~~~~~~^~~~~~~
/in/sort.hpp: In instantiation of 'void merge(std::vector<T>&, int, int, int) [with T = node]':
/in/sort.hpp:113:14:   required from 'void merge_sort_helper(std::vector<T>&, int, int) [with T = node]'
/in/sort.hpp:122:22:   required from 'void merge_sort(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]'
/in/driver/main.cpp:143:44:   required from here
/in/sort.hpp:62:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i = 0; i < leftVec.size(); i++)
/in/sort.hpp:67:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int j = 0; j < rightVec.size(); j++)
/in/sort.hpp:74:14: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     while (a < leftVec.size() && b < rightVec.size())
/in/sort.hpp:74:36: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     while (a < leftVec.size() && b < rightVec.size())
/in/sort.hpp:77:24: error: no match for 'operator<=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}' and '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}')
         if (leftVec[a] <= rightVec[b])
             ~~~~~~~~~~~^~~~~~~~~~~~
/in/sort.hpp:91:14: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     while (a < leftVec.size())
/in/sort.hpp:97:14: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     while (b < rightVec.size())
/in/sort.hpp: In instantiation of 'int partition(std::vector<T>&, int, int) [with T = node]':
/in/sort.hpp:197:32:   required from 'void quick_sort_inplace_helper(std::vector<T>&, int, int) [with T = node]'
/in/sort.hpp:208:30:   required from 'void quick_sort_inplace(std::vector<T>&, Compare) [with T = node; Compare = bool (*)(const node&, const node&)]'
/in/driver/main.cpp:151:52:   required from here
/in/sort.hpp:181:40: error: no match for 'operator<=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}' and 'node')
         while (i <= right && vector[i] <= pivot) i++;
                              ~~~~~~~~~~^~~~~~~~
/in/sort.hpp:182:45: error: no match for 'operator>=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<node> >::value_type {aka node}' and 'node')
         while ((left + 1) <= j && vector[j] >= pivot) j--;
                                   ~~~~~~~~~~^~~~~~~~
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 1
Language
C++
Submit At
2021-10-18 05:27:32
Judged At
2021-10-18 05:27:32
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes