ctor_alloc.pass.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. // <queue>
  9. // template <class Alloc>
  10. // explicit queue(const Alloc& a);
  11. #include <queue>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. #include "test_allocator.h"
  15. struct test
  16. : private std::queue<int, std::deque<int, test_allocator<int> > >
  17. {
  18. typedef std::queue<int, std::deque<int, test_allocator<int> > > base;
  19. explicit test(const test_allocator<int>& a) : base(a) {}
  20. test(const container_type& c, const test_allocator<int>& a) : base(c, a) {}
  21. #if TEST_STD_VER >= 11
  22. test(container_type&& c, const test_allocator<int>& a) : base(std::move(c), a) {}
  23. test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
  24. #endif
  25. test_allocator<int> get_allocator() {return c.get_allocator();}
  26. };
  27. int main(int, char**)
  28. {
  29. test q(test_allocator<int>(3));
  30. assert(q.get_allocator() == test_allocator<int>(3));
  31. return 0;
  32. }