#include <queue>
#include <vector>
#include <functional>
using namespace std;

template<typename Pair>
struct GreaterBySecond {
	bool operator()(Pair a, Pair b) const {
		return a.second > b.second;
	}
};

int main(){
    typedef pair<int,float> ifpair;
    GreaterBySecond<ifpair> comp;
    typedef priority_queue< ifpair , vector<ifpair>, decltype( comp ) > t_npq;
    t_npq npq( comp );
    //do something with npq. finish using it (without emptying it) and clear for next round
    t_npq empty( comp );
    swap(npq , empty);
}
