cpp/memory/out ptr t

is used to adapt types such as smart pointers for foreign functions that output their results via a (usually  for some object type ) or  parameter.

captures additional arguments on construction, provides a storage for the result to which such an aforementioned foreign function writes, and finally resets the adapted object with the result and the captured arguments when it is destroyed.

behaves as if it holds following non-static data members:
 * a reference, which is bound to the adapted object on construction,
 * for every in, a member of type , which is an argument captured on construction and used for resetting while destruction, and
 * a member subobject that suitable for storing a within it and providing a  object, where the  or  object is generally exposed to a foreign function for re-initialization.

Users can control whether each argument for resetting is captured by copy or by reference, by specifying an object type or a reference type in respectively.

Specializations
Unlike most class templates in the standard library, program-defined specializations of that depend on at least one program-defined type need not meet the requirements for the primary template.

This license allows a program-defined specialization to expose the raw pointer stored within a non-standard smart pointer to foreign functions.