Problem inserting into vector and map of class with elements

(main) Quashtest.cpp http://codepad.org/dvPdYL9C

Quash.cpp http://codepad.org/cnuEuAeg

Quash.h http://codepad.org/q0Mjhk9u

Hashtable.cpp http://codepad.org/GSjMyZVJ

Hashtable.h http://codepad.org/ZAkKiXT4

Minheap.cpp http://codepad.org/UyNKZlsS //only thing different is int get_number is a constant same for .h file

Minheap.h http://codepad.org/6ZcouN5C

errors depending on if i remove the less comparator or leave it in.
WITH LESS COMPARATOR
1
2
3
4
5
6
7
8
9
10
11
12
jlhunter@jaguar:~/311/P3$ make
make: Warning: File `quash.h' has modification time 51 s in the future
g++ -Wall -g -c -I. quashTest.cpp
In file included from quashTest.cpp:12:
quash.h: In member function 'bool Quash::less(const Minheap&, const Minheap&)':
quash.h:37: error: passing 'const Minheap' as 'this' argument of 'const int Minh                                                                                                                                                             eap::get_Number()' discards qualifiers
quash.h:37: error: passing 'const Minheap' as 'this' argument of 'const int Minh                                                                                                                                                             eap::get_Number()' discards qualifiers
quashTest.cpp: In function 'int main(int, char**)':
quashTest.cpp:73: warning: unused variable 'p'
quashTest.cpp:74: warning: unused variable 'q'
quashTest.cpp:79: warning: unused variable 'size'
make: *** [quashTest.o] Error 1 


WITHOUT:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
jlhunter@jaguar:~/311/P3$ make
g++ -Wall -g -c -I. quash.cpp
quash.cpp: In member function 'int Quash::insert(int)':
quash.cpp:37: error: no matching function for call to 'Hashtable::Hashtable(int&, __gnu_cxx::__normal_iterator<Minheap*, std::vector<Minheap, std::allocator<Minheap> > >, bool)'
Hashtable.h:10: note: candidates are: Hashtable::Hashtable(int, unsigned int*, bool)
Hashtable.h:8: note:                 Hashtable::Hashtable(const Hashtable&)
quash.cpp:38: warning: taking address of temporary
quash.cpp:38: error: cannot convert '__gnu_cxx::__normal_iterator<Minheap*, std::vector<Minheap, std::allocator<Minheap> > >*' to 'unsigned int*' in assignment
In file included from /usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/bits/stl_algo.h:62,
                 from /usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/algorithm:62,
                 from quash.cpp:8:
/usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/bits/stl_heap.h: In function 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Minheap*, std::vector<Minheap, std::allocator<Minheap> > >, _Distance = long int, _Tp = Minheap]':
/usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/bits/stl_heap.h:394:   instantiated from 'void std::make_heap(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<Minheap*, std::vector<Minheap, std::allocator<Minheap> > >]'
quash.cpp:39:   instantiated from here
/usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/bits/stl_heap.h:232: error: no match for 'operator<' in '__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+ [with _Iterator = Minheap*, _Container = std::vector<Minheap, std::allocator<Minheap> >](((const ptrdiff_t&)((const ptrdiff_t*)(& __secondChild)))).__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* [with _Iterator = Minheap*, _Container = std::vector<Minheap, std::allocator<Minheap> >]() < __first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+ [with _Iterator = Minheap*, _Container = std::vector<Minheap, std::allocator<Minheap> >](((const ptrdiff_t&)((const ptrdiff_t*)(&(__secondChild + -0x00000000000000001l))))).__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* [with _Iterator = Minheap*, _Container = std::vector<Minheap, std::allocator<Minheap> >]()'
/usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/bits/stl_heap.h: In function 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Minheap*, std::vector<Minheap, std::allocator<Minheap> > >, _Distance = long int, _Tp = Minheap]':
/usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/bits/stl_heap.h:244:   instantiated from 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Minheap*, std::vector<Minheap, std::allocator<Minheap> > >, _Distance = long int, _Tp = Minheap]'
/usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/bits/stl_heap.h:394:   instantiated from 'void std::make_heap(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<Minheap*, std::vector<Minheap, std::allocator<Minheap> > >]'
quash.cpp:39:   instantiated from here
/usr/lib64/gcc/x86_64-slackware-linux/4.4.4/../../../../include/c++/4.4.4/bits/stl_heap.h:134: error: no match for 'operator<' in '__first.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+ [with _Iterator = Minheap*, _Container = std::vector<Minheap, std::allocator<Minheap> >](((const ptrdiff_t&)((const ptrdiff_t*)(& __parent)))).__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator* [with _Iterator = Minheap*, _Container = std::vector<Minheap, std::allocator<Minheap> >]() < __value'
make: *** [quash.o] Error 1

bump?
Topic archived. No new replies allowed.