|
-
August 7th, 2012, 08:13 PM
#1
vector- algorithm const problem
Hi this is my first time posting to this forum - please forgive me in advance if any part of this request is inappropriate. I am compiling free source code in cygwin g++ and I am getting the following error message:
In file included from /usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/algorithm:63:0,
from saMultiChoiceKnapsack.cpp:27:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_algo.h: In function ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<GreedyObject*, std::vector<GreedyObject> >, _Tp = GreedyObject]’:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_algo.h:2249:70: instantiated from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<GreedyObject*, std::vector<GreedyObject> >]’
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_algo.h:2280:54: instantiated from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<GreedyObject*, std::vector<GreedyObject> >, _Size = int]’
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_algo.h:5212:4: instantiated from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<GreedyObject*, std::vector<GreedyObject> >]’
saMultiChoiceKnapsack.cpp:121:43: instantiated from here
/usr/lib/gcc/i686-pc-cygwin/4.5.3/include/c++/bits/stl_algo.h:2211:4: error: passing ‘const GreedyObject’ as ‘this’ argument of ‘bool GreedyObject: perator<(const GreedyObject&)’ discards qualifiers
I am doing research on Multiple Dimension Multiple Choice Knapsack problems. I need the results from several tests to continue my research. I do program, but I am not a C++ programmer. The link to the source code can be found here:
http://shah.freeshell.org/samulticho...ceKnapsack.cpp
Any help would be appreciated.
Frustrated grad student
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|