faizkhan00/mastercore — pull request #1 by dexX7 (2014-11-08 13:56:58+00:00)
Title: std::sort with CMPMetaDEx and MetaDEx_compare

This was actually intended as test and then as demonstration. The important part is in [e2cee38](https://github.com/dexX7/bitcoin/commit/e2cee38514e56f75c605424b018f739886e2b8f9) and the whole sorting can be significantly simplified, because there is already [bool MetaDEx_compare::operator()(const CMPMetaDEx &lhs, const CMPMetaDEx &rhs)](https://github.com/faizkhan00/mastercore/blob/rpc-enhancements/src/mastercore_dex.cpp#L1001) - a comparator that can be used in combination with [std::sort](http://www.cplusplus.com/reference/algorithm/sort/) to sort vectors of CMPMetaDEx based on block height and position within a block:

```c++
std::vector vMetaDexObjs; // holds unordered data
...
MetaDEx_compare compareByHeight; // in mastercore_dex.h
std::sort (vMetaDexObjs.begin(), vMetaDexObjs.end(), compareByHeight); // sort by blk height + tx pos
```