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 // <set>
     11 
     12 // class set
     13 
     14 // set(initializer_list<value_type> il, const key_compare& comp = key_compare());
     15 
     16 #include <set>
     17 #include <cassert>
     18 
     19 #include "../../../min_allocator.h"
     20 
     21 int main()
     22 {
     23 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
     24     {
     25     typedef std::set<int> C;
     26     typedef C::value_type V;
     27     C m = {1, 2, 3, 4, 5, 6};
     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     }
     38 #if __cplusplus >= 201103L
     39     {
     40     typedef std::set<int, std::less<int>, min_allocator<int>> C;
     41     typedef C::value_type V;
     42     C m = {1, 2, 3, 4, 5, 6};
     43     assert(m.size() == 6);
     44     assert(distance(m.begin(), m.end()) == 6);
     45     C::const_iterator i = m.cbegin();
     46     assert(*i == V(1));
     47     assert(*++i == V(2));
     48     assert(*++i == V(3));
     49     assert(*++i == V(4));
     50     assert(*++i == V(5));
     51     assert(*++i == V(6));
     52     }
     53 #endif
     54 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
     55 }
     56