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#include <utility>
24
25#include "test_macros.h"
26
27int main(int, char**)
28{
29 std::pair<int*, std::ptrdiff_t> ip = std::get_temporary_buffer<int>(5);
30 assert(ip.first);
31 assert(ip.second == 5);
32 std::return_temporary_buffer(ip.first);
33
34 return 0;
35}
36

source code of libcxx/test/std/utilities/memory/temporary.buffer/temporary_buffer.pass.cpp