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