Given:

```
struct Object {
    int id;
    ...
};

list<Object> objectList;
list<int> idList;

```

What is the best way to order `objectList` depending on order of `idList`?

Example (pseudo code):

```
INPUT
    objectList = {o1, o2, o3};
    idList = {2, 3, 1};

ACTION
    sort(objectList, idList);

OUTPUT
    objectList = {o2, o3, o1};

```

I searched in documentation but I only found methods to order elements comparing among themselves.