|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have problems compiling the ff line:
std::sort(sequence_set.begin(), sequence_set.end()); Error 2 error C2784: 'reverse_iterator<_RanIt>::difference_type std: perator -(const std::reverse_iterator<_RanIt> &,conststd::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'std::_Tree<_Traits>::iterator' c:\program files\microsoft visual studio 8\vc\include\algorithm 2754 The variable sequence_set is of type std::set, and contains classes which have the ff comparison operators defined: '==', '>', and '<' (equality, greater than and less than) |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Oct 16, 7:00 pm, Anonymous <no.re...@here.com> wrote:
> I have problems compiling the ff line: > > std::sort(sequence_set.begin(), sequence_set.end()); > > Error 2 error C2784: 'reverse_iterator<_RanIt>::difference_type > std: perator -(const std::reverse_iterator<_RanIt> &,const> std::reverse_iterator<_RanIt2> &)' : could not deduce template argument > for 'const std::reverse_iterator<_RanIt> &' from > 'std::_Tree<_Traits>::iterator' c:\program files\microsoft visual > studio 8\vc\include\algorithm 2754 > > The variable sequence_set is of type std::set, and contains classes > which have the ff comparison operators defined: > > '==', '>', and '<' (equality, greater than and less than) A std::set is already sorted, and you cannot rearrange the ordering of the elements within it. For that matter, std::sort requires random access iterators, which a std::set does not have. Hence, you cannot call std::sort on it. Perhaps you should explain what it is you are trying to accomplish. Best regards, Tom |
|
![]() |
| Outils de la discussion | |
|
|