temporary_buffer.pass.cpp 815 B

1234567891011121314151617181920212223242526272829303132
  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. // <memory>
  9. // template <class T>
  10. // pair<T*, ptrdiff_t>
  11. // get_temporary_buffer(ptrdiff_t n);
  12. //
  13. // template <class T>
  14. // void
  15. // return_temporary_buffer(T* p);
  16. #include <memory>
  17. #include <cassert>
  18. #include "test_macros.h"
  19. int main(int, char**)
  20. {
  21. std::pair<int*, std::ptrdiff_t> ip = std::get_temporary_buffer<int>(5);
  22. assert(ip.first);
  23. assert(ip.second == 5);
  24. std::return_temporary_buffer(ip.first);
  25. return 0;
  26. }