Record Detail

Compile Error

In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In instantiation of 'Value& HashTable<Key, Value, Hash, KeyEqual>::operator[](const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/driver/main.cpp:129:94:   required from here
/in/hashtable.hpp:376:66: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         firstBucketIt = (firstBucketIt == buckets.end() || index < std::distance(buckets.begin(), firstBucketIt)) ? buckets.begin() + index : firstBucketIt;
                                                            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/in/hashtable.hpp: In instantiation of 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(const HashTable<Key, Value, Hash, KeyEqual>::Iterator&, const Key&, const Value&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]':
/in/hashtable.hpp:305:22:   required from 'bool HashTable<Key, Value, Hash, KeyEqual>::insert(const Key&, const Value&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]'
/in/driver/main.cpp:111:43:   required from here
/in/hashtable.hpp:281:13: error: passing 'const HashTable<int, int, std::hash<int>, std::equal_to<int> >::Iterator' as 'this' argument discards qualifiers [-fpermissive]
             it->second = value;
             ^~
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:116:19: note:   in call to 'HashTable<Key, Value, Hash, KeyEqual>::HashNode* HashTable<Key, Value, Hash, KeyEqual>::Iterator::operator->() [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>; HashTable<Key, Value, Hash, KeyEqual>::HashNode = std::pair<const int, int>]'
         HashNode *operator->() {
                   ^~~~~~~~
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp:287:66: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         firstBucketIt = (firstBucketIt == buckets.end() || index < std::distance(buckets.begin(), firstBucketIt)) ? buckets.begin() + index : firstBucketIt;
                                                            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /in/driver/main.cpp:5:0:
/in/hashtable.hpp: In instantiation of 'size_t HashTable<Key, Value, Hash, KeyEqual>::findMinimumBucketSize(size_t) const [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>; size_t = long unsigned int]':
/in/hashtable.hpp:390:43:   required from 'void HashTable<Key, Value, Hash, KeyEqual>::rehash(size_t) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>; size_t = long unsigned int]'
/in/hashtable.hpp:375:15:   required from 'Value& HashTable<Key, Value, Hash, KeyEqual>::operator[](const Key&) [with Key = int; Value = int; Hash = std::hash<int>; KeyEqual = std::equal_to<int>]'
/in/driver/main.cpp:129:94:   required from here
/in/hashtable.hpp:173:89: error: conversion to 'double' from 'long unsigned int' may alter its value [-Werror=conversion]
         size_t minRequiredBuckets = std::max(bucketSize, static_cast<size_t>(std::floor(tableSize / maxLoadFactor) + 1));
                                                                                         ^~~~~~~~~
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Project 2: Hashing
Language
C++
Submit At
2024-11-10 16:08:22
Judged At
2024-11-10 16:08:22
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes