I have a container storage pointer. I am trying to sort these pointers in a consistent manner based on the data element in the corresponding objects that the pointers point to. In my case, it is possible that many objects have the same value for this data item.
Below is a short code illustrating the problem. Calling the sort function gives a segmentation error. The strangest thing about this is, if I have 16 elements in the container pointing to objects with the same value for the double, it looks like this view works. But if I have 17 elements pointing to objects with the same value, this gives a seg error.
Can someone explain why this is happening?
#include <iostream>
source share