Boost logo

Boost Users :

Subject: [Boost-users] [unordered] order in container
From: gast128 (gast128_at_[hidden])
Date: 2013-06-14 10:58:25


Hello all,

although it's called 'unordered_set', it surprised me that an unordered
container could have a different ordering although its contents are the same:

void f()
{
   boost::unordered_set<int> uset1;
   uset1.insert(10);
   uset1.insert(9);
   uset1.insert(8);

   boost::unordered_set<int> uset2;
   uset2.insert(8);
   uset2.insert(9);
   uset2.insert(10);
   
   //uset1: 8, 9, 10
   //uset2: 10, 9, 8

   bool b = uset1 == uset2; //ok, they are the same
}

Maybe it is somewhere in the documentation, otherwise maybe add a
documentation note.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net