initializer_list.pass.cpp 1007 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // UNSUPPORTED: c++98, c++03
  9. // <vector>
  10. // vector(initializer_list<value_type> il);
  11. #include <vector>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. #include "min_allocator.h"
  15. int main(int, char**)
  16. {
  17. {
  18. std::vector<bool> d = {true, false, false, true};
  19. assert(d.size() == 4);
  20. assert(d[0] == true);
  21. assert(d[1] == false);
  22. assert(d[2] == false);
  23. assert(d[3] == true);
  24. }
  25. {
  26. std::vector<bool, min_allocator<bool>> d = {true, false, false, true};
  27. assert(d.size() == 4);
  28. assert(d[0] == true);
  29. assert(d[1] == false);
  30. assert(d[2] == false);
  31. assert(d[3] == true);
  32. }
  33. return 0;
  34. }