Skip to content

Latest commit

 

History

History
118 lines (58 loc) · 1.69 KB

2-18-shared-ptr.md

File metadata and controls

118 lines (58 loc) · 1.69 KB

Dale

Previous | Next

2.18 shared-ptr

Details

Module: shared-ptr

Description

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

Structs

(SharedPtr T)

Linkage: N/A Members: N/A

The core shared pointer structure type.

Functions

init

Linkage: extern Returns: bool Parameters:

  • (loc (ref (SharedPtr T))): The shared pointer.
  • (value (p T)): The value to assign to the shared pointer.

Initialise the shared 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 (SharedPtr T))): The shared pointer.

Initialise an empty/null shared pointer structure.

get

Linkage: extern Returns: (p T) Parameters:

  • (mloc (SharedPtr T)): The shared pointer.

Returns the underlying pointer.

@

Linkage: extern Returns: T Parameters:

  • (mloc (SharedPtr T)): The shared pointer.

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

Concept macros

SharedPtr

Linkage: extern Parameters:

  • (T Type): The type node.

Expands to a SharedPtr definition over the relevant type.

Macros

SharedPtr

Linkage: extern Parameters:

  • T: The type node.

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

Previous | Next