Boost logo

Boost Users :

Subject: [Boost-users] [tuples] sorting vector of boost-tuples
From: Christian Meesters (meesters_at_[hidden])
Date: 2010-09-09 03:45:43


Hi,

Don't know whether this is a boost-thing or C++ ... hope to put the
problem the right way.

Anyway, I have a tuple:

    //! tuple of <marker id, r2, allele>
    typedef boost::tuple<std::string, double, char> Proxy;

and a map like

    //! map of <marker id, <vector of Proxies> >
    typedef std::map<std::string, std::vector<Proxy> > ProxyLT;

Now,

    ProxyLT proxies;
    proxy = boost::tuple<std::string, double, char>(some string id, some
double, some character);

    // pushing this tuple into the map/vector construct
    proxies[some other string id].push_back(proxy);

And now I would like to sort these vectors within the map vector by
vector according to the double in the tuple. For this I have the
function (within a header file):

    inline bool proxy_gt(Proxy first, Proxy second) {
        return (first.get<1>() > second.get<1>());
    }

and then the actual sorting:
    for (yamas::ProxyLT::iterator pit = proxies.begin(); pit !=
         proxies.end(); pit++) {
        sort((*pit).second.begin(), (*pit).second.end(), proxy_gt);
        }

Problem is that g++ keeps telling me

/usr/include/c++/4.4/bits/stl_heap.h:180: error: must use '.*' or '->*'
to call pointer-to-member function in '__comp (...)', e.g. '(... ->*
__comp) (...)'

when 'sort' is called.

Whatever I do to the inline function - I cannot solve this problem. Any
hints?

TIA

Cheers
Christian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net