public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31951]  New: local structure problem
@ 2007-05-16 12:55 ndbecker2 at gmail dot com
  2007-05-16 22:16 ` [Bug c++/31951] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ndbecker2 at gmail dot com @ 2007-05-16 12:55 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-05 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-16 12:55 [Bug c++/31951] New: local structure problem ndbecker2 at gmail dot com
2007-05-16 22:16 ` [Bug c++/31951] " pinskia at gcc dot gnu dot org
2007-05-17 14:48 ` bangerth at dealii dot org
2009-10-05 14:42 ` dmitry at lsi dot upc dot edu
2009-10-05 14:58 ` redi at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).