ctor_rcontainer.pass.cpp 870 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. // <stack>
  10. // explicit stack(container_type&& c);
  11. #include <stack>
  12. #include <cassert>
  13. #include "MoveOnly.h"
  14. #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
  15. template <class C>
  16. C
  17. make(int n)
  18. {
  19. C c;
  20. for (int i = 0; i < n; ++i)
  21. c.push_back(MoveOnly(i));
  22. return c;
  23. }
  24. #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
  25. int main()
  26. {
  27. #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
  28. std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5));
  29. assert(q.size() == 5);
  30. #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
  31. }