Sorting algorithms take tuples of keys/values

One will also has to explicitly specify the comparison function. Both
host and device variants of the comparison functor should take 2*n
arguments, where n is number of keys. First n arguments correspond to a
left set of keys, and second n arguments correspond to a right set of
keys. Here is an example that sorts values by a tuple of two keys:

    vex::vector<int>    keys1(ctx, n);
    vex::vector<float>  keys2(ctx, n);
    vex::vector<double> vals (ctx, n);

    struct {
        VEX_FUNCTION(device, bool(int, float, int, float),
                "return (prm1 == prm3) ? (prm2 < prm4) : (prm1 < prm3);"
                );
        bool operator()(int a1, float a2, int b1, float b2) const {
            return std::make_tuple(a1, a2) < std::tuple(b1, b2);
        }
    } comp;

    vex::sort_by_key(std::tie(keys1, keys2), vals);