   Questions about std::set
  I'm reading a code that is base on STL. here's the code:<code>class A{public:std::vector<int> Array;};struct LessIndexes{bool operator()(A *s1, A *s2){for ( int c = 0; c < s1->Array.size(); c++ ){for ( int d = 0; d < s2->Array.size(); d++ ){cout << "comparing " << s1->Array[c] << " with" << s2->Array[d] << endl;if( s1->Array[c] > s2->Array[d] ){cout << s1->Array[c] << " is greater than " << s2->Array[d] << endl;return true;}}}return false;}};typedef std::set<A*, LessIndexes>indexes;</code>I have testes this code with some values, but I can't understand how the std::set works. Here's my test code:<code>A* s1 = new A;A *s2 = new A;A* s3 = new A;s1->Array.push_back( 10 );s1->Array.push_back( 50 );s2->Array.push_back( 0 );s2->Array.push_back( 10 );s3->Array.push_back( 40 );s3->Array.push_back( 50 );indexes idx;std::pair<indexes::iterator, bool> result = idx.insert( s1 );if( result.second )cout << "Firs member ";result = idx.insert( s2 );if( result.second )cout << "Second member ";result = idx.insert( s3 );if( result.second )cout << "Third member";</code>In this case, all the A* members are inserted in idx. Why?-Ehsan-   
  You inserted all three, and they're all different. Why would anything else happen?Besides, your comparison predicate isn't a strict ordering. For instance, s1 < s1 evaluates to true.   