Home | History | Annotate | Download | only in set.cons
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // UNSUPPORTED: c++98, c++03
     11 
     12 // <set>
     13 
     14 // class set
     15 
     16 // set(initializer_list<value_type> il, const key_compare& comp = key_compare());
     17 
     18 #include <set>
     19 #include <cassert>
     20 #include "../../../test_compare.h"
     21 
     22 int main()
     23 {
     24     typedef test_compare<std::less<int> > Cmp;
     25     typedef std::set<int, Cmp> C;
     26     typedef C::value_type V;
     27     C m({1, 2, 3, 4, 5, 6}, Cmp(10));
     28     assert(m.size() == 6);
     29     assert(distance(m.begin(), m.end()) == 6);
     30     C::const_iterator i = m.cbegin();
     31     assert(*i == V(1));
     32     assert(*++i == V(2));
     33     assert(*++i == V(3));
     34     assert(*++i == V(4));
     35     assert(*++i == V(5));
     36     assert(*++i == V(6));
     37     assert(m.key_comp() == Cmp(10));
     38 }
     39