Skip to content

Problem using arbitrary struct as value parameter in compute::sort_by_key() #162

@jesko42

Description

@jesko42

Hello Kyle,

I tried to use compute::sort_by_key with a vector as key and a struct like that

typedef struct
{
    float a;
    float v[20];
} imx;
vector<imx>

as the value (or payload).
But unfortunately I cannot use this struct, only basic data types like int, float, double or so ...
Browsing the code it looks not too difficult to extend the current behaviour ...

/Jesko

//--------------------------------------------------------- code snippet below
    std::vector<float> host_vector_keys(33);
    std::vector<imx> host_vector_payload(host_vector_keys.size());
    compute::vector<float> device_vector_keys = host_vector_keys;
    compute::vector<imx> device_vector_payload = host_vector_payload;
    compute::sort_by_key(device_vector_keys.begin(), device_vector_keys.end(), device_vector_payload.begin());

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions