Home | History | Annotate | Download | only in temporary.buffer
      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 
     10 // <memory>
     11 
     12 // template <class T>
     13 //   pair<T*, ptrdiff_t>
     14 //   get_temporary_buffer(ptrdiff_t n);
     15 //
     16 // template <class T>
     17 //   void
     18 //   return_temporary_buffer(T* p);
     19 
     20 #include <memory>
     21 #include <cassert>
     22 
     23 int main()
     24 {
     25     std::pair<int*, std::ptrdiff_t> ip = std::get_temporary_buffer<int>(5);
     26     assert(ip.first);
     27     assert(ip.second == 5);
     28     std::return_temporary_buffer(ip.first);
     29 }
     30