This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31951] New: local structure problem
- From: "ndbecker2 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 May 2007 12:55:15 -0000
- Subject: [Bug c++/31951] New: local structure problem
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
2nd call to partial_sort gives 'no match...' error, but 1st is OK.
Doesn't seem right.
#include <algorithm>
#include <vector>
template<typename vector_t>
struct Sort_Func2 {
vector_t const& mag;
Sort_Func2 (vector_t const& _mag) : mag (_mag) {}
bool operator() (int a, int b) const { return mag [a] < mag [b]; }
};
template<typename vector_t>
void F (vector_t const& v) {
struct Sort_Func {
vector_t const& mag;
Sort_Func (vector_t const& _mag) : mag (_mag) {}
bool operator() (int a, int b) const { return mag [a] < mag [b]; }
};
std::vector<int> indexes (v.size());
std::partial_sort (indexes.begin(), indexes.begin()+2, indexes.end(),
Sort_Func2<vector_t> (v));
std::partial_sort (indexes.begin(), indexes.begin()+2, indexes.end(),
Sort_Func (v));
}
int main() {
std::vector<int> v;
F (v);
}
--
Summary: local structure problem
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ndbecker2 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31951