In my project I use std::set with custom Compare function for maintaining an event queue. It fulfills following criteria:event duplication is not allowedshould maintain the insertion order(tried std::vector first, but that performed poorly because of complicated duplicate removal)The important code is:template <typename T>class EventQueue {public:  EventQueue() : set_(std::set<DataWrap>()) {}  void Insert(T elem) {    set_.insert(DataWrap(elem, set_.size()));  }  // ....private:  struct DataWrap {    T data;    unsigned int order;    DataWrap(T d, unsigned int o) : data(d), order(o) {}    bool operator<(const DataWrap& other) const {      if (data == other.data)        return false;      else        return order < other.order;    }  };  std::set<DataWrap> set_;};Naturally I want to avoid undefined behaviour. As far as I can see my Compare fulfills the requirements of strick weak ordering (irreflexive, transitive, asymetric)Can you confirm that this code is well-defined, or am I missing something? Thanks for your time!
Set with custom compare
c++;set