Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Structs SharedRefCount

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module juptune.core.ds.pointer;

struct SharedRefCount(
    alias ValueT
)
{
    /++ STRUCTS ++/
    
    ///
    struct Payload
    {
        /++ VARIABLES ++/
        
        ///
        ptrdiff_t _count;
        ///
        ValueT _value;
    }
    
    /++ ALIASES ++/
    
    /// Safely accesses the underlying shared value. 
    alias access = ;
    /// ditto. 
    alias accessGC = ;
    /// Instantiates this SharedRefCount, using the provided init function to setup the underlying value. 
    alias make = ;
    /// ditto. 
    alias makeGC = ;
    
    /++ FUNCTIONS ++/
    
    ///
    Result accessImpl(DelegateT)(DelegateT func);
    /// Returns: Whether this SharedRefCount has a value or not. 
    bool isNull();
    ///
    Result makeImpl(DelegateT)(DelegateT initFunc);
    
    /++ VARIABLES ++/
    
    ///
    shared shared Payload* _payload;
}

Documentation

A shared ref counted pointer.

Notes

Memory management is only handled by stdc's calloc & friends.

Because I don't want to complicate things too much right now, ValueTmust be a zero-init type.

Aliases

Name Description
access

Safely accesses the underlying shared value.

accessGC

ditto.

make

Instantiates this SharedRefCount, using the provided init function to setup the underlying value.

makeGC

ditto.

Functions

Name Description
accessImpl
isNull

Returns: Whether this SharedRefCount has a value or not.

makeImpl

Structs

Name Description
Payload

Variables

Name Description
_payload