Skip to content

Files

Latest commit

a738372 · Dec 29, 2016

History

History
118 lines (58 loc) · 1.72 KB

2-19-unique-ptr.md

File metadata and controls

118 lines (58 loc) · 1.72 KB

Dale

Previous | Next

2.19 unique-ptr

Details

Module: unique-ptr

Description

A unique pointer module. Apart from the UniquePtr macro and concept macro, the documentation in this module is for a generated unique pointer instance of type T.

Structs

(UniquePtr T)

Linkage: N/A Members: N/A

The core unique pointer structure type.

Functions

init

Linkage: extern Returns: bool Parameters:

  • (loc (ref (UniquePtr T))): The unique pointer.
  • (value (p T)): The value to assign to the unique pointer.

Initialise the unique pointer structure with a pointer. Once the structure has been initialised with the pointer, it takes ownership of it. The structure assumes that the pointer was created by way of malloc.

init

Linkage: extern Returns: bool Parameters:

  • (loc (ref (UniquePtr T))): The unique pointer.

Initialise an empty/null unique pointer structure.

get

Linkage: extern Returns: (p T) Parameters:

  • (mloc (ref (UniquePtr T))): The unique pointer.

Returns the underlying pointer.

@

Linkage: extern Returns: T Parameters:

  • (mloc (ref (UniquePtr T))): The unique pointer.

Dereferencing the unique pointer returns the value from the underlying pointer.

Concept macros

UniquePtr

Linkage: extern Parameters:

  • (T Type): The type node.

Expands to a UniquePtr definition over the relevant type.

Macros

UniquePtr

Linkage: extern Parameters:

  • T: The type node.

Expands to the concrete type name of the UniquePtr generated by way of the concept macro.

Previous | Next