Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/memory.hfa

    r8be729f rfd54fef  
    1010// Created On       : Tue Jun  2 16:48:00 2020
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jan 29 15:52:00 2021
    13 // Update Count     : 1
     12// Last Modified On : Tue Jun  3 12:29:00 2020
     13// Update Count     : 0
    1414//
    1515
     
    1717
    1818// Internal data object.
    19 forall(T & | sized(T))
    20 struct counter_data {
    21         unsigned int counter;
    22         T object;
    23 };
     19forall(T & | sized(T)) {
     20        struct counter_data {
     21                unsigned int counter;
     22                T object;
     23        };
    2424
    25 forall(T & | sized(T), Args... | { void ?{}(T &, Args); })
    26 void ?{}(counter_data(T) & this, Args args);
     25        forall(Args... | { void ?{}(T &, Args); })
     26        void ?{}(counter_data(T) & this, Args args);
    2727
    28 forall(T & | sized(T) | { void ^?{}(T &); })
    29 void ^?{}(counter_data(T) & this);
     28        forall( | { void ^?{}(T &); })
     29        void ^?{}(counter_data(T) & this);
     30}
    3031
    3132// This is one of many pointers keeping this alive.
    32 forall(T & | sized(T))
    33 struct counter_ptr {
    34         counter_data(T) * data;
    35 };
     33forall(T & | sized(T)) {
     34        struct counter_ptr {
     35                counter_data(T) * data;
     36        };
    3637
    37 forall(T & | sized(T))
    38 void ?{}(counter_ptr(T) & this);
    39 forall(T & | sized(T))
    40 void ?{}(counter_ptr(T) & this, zero_t);
    41 forall(T & | sized(T))
    42 void ?{}(counter_ptr(T) & this, counter_ptr(T) that);
    43 forall(T & | sized(T), Args... | { void ?{}(T&, Args); })
    44 void ?{}(counter_ptr(T) & this, Args args);
     38        void ?{}(counter_ptr(T) & this);
     39        void ?{}(counter_ptr(T) & this, zero_t);
     40        forall( | { void ^?{}(T &); })
     41        void ?{}(counter_ptr(T) & this, counter_ptr(T) that);
     42        forall(Args... | { void ?{}(T&, Args); })
     43        void ?{}(counter_ptr(T) & this, Args args);
    4544
    46 forall(T & | sized(T) | { void ^?{}(T &); })
    47 void ^?{}(counter_ptr(T) & this);
     45        forall( | { void ^?{}(T &); })
     46        void ^?{}(counter_ptr(T) & this);
    4847
    49 forall(T & | sized(T))
    50 T & *?(counter_ptr(T) & this);
     48        T & *?(counter_ptr(T) & this);
    5149
    52 forall(T & | sized(T) | { void ^?{}(T &); })
    53 void ?=?(counter_ptr(T) & this, counter_ptr(T) that);
    54 forall(T & | sized(T) | { void ^?{}(T &); })
    55 void ?=?(counter_ptr(T) & this, zero_t);
     50        forall( | { void ^?{}(T &); })
     51        void ?=?(counter_ptr(T) & this, counter_ptr(T) that);
     52        forall( | { void ^?{}(T &); })
     53        void ?=?(counter_ptr(T) & this, zero_t);
    5654
    57 forall(T & | sized(T))
    58 int ?==?(counter_ptr(T) const & this, counter_ptr(T) const & that);
    59 forall(T & | sized(T))
    60 int ?!=?(counter_ptr(T) const & this, counter_ptr(T) const & that);
    61 forall(T & | sized(T))
    62 int ?==?(counter_ptr(T) const & this, zero_t);
    63 forall(T & | sized(T))
    64 int ?!=?(counter_ptr(T) const & this, zero_t);
     55        int ?==?(counter_ptr(T) const & this, counter_ptr(T) const & that);
     56        int ?!=?(counter_ptr(T) const & this, counter_ptr(T) const & that);
     57        int ?==?(counter_ptr(T) const & this, zero_t);
     58        int ?!=?(counter_ptr(T) const & this, zero_t);
     59}
    6560
    6661// This is the only pointer that keeps this alive.
    67 forall(T &)
    68 struct unique_ptr {
    69         T * data;
    70 };
     62forall(T &) {
     63        struct unique_ptr {
     64                T * data;
     65        };
    7166
    72 forall(T &)
    73 void ?{}(unique_ptr(T) & this);
    74 forall(T &)
    75 void ?{}(unique_ptr(T) & this, zero_t);
    76 forall(T &)
    77 void ?{}(unique_ptr(T) & this, unique_ptr(T) that) = void;
    78 forall(T & | sized(T), Args... | { void ?{}(T &, Args); })
    79 void ?{}(unique_ptr(T) & this, Args args);
     67        void ?{}(unique_ptr(T) & this);
     68        void ?{}(unique_ptr(T) & this, zero_t);
     69        void ?{}(unique_ptr(T) & this, unique_ptr(T) that) = void;
     70        forall( | sized(T), Args... | { void ?{}(T &, Args); })
     71        void ?{}(unique_ptr(T) & this, Args args);
    8072
    81 forall(T & | { void ^?{}(T &); })
    82 void ^?{}(unique_ptr(T) & this);
     73        forall( | { void ^?{}(T &); })
     74        void ^?{}(unique_ptr(T) & this);
    8375
    84 forall(T & )
    85 T & *?(unique_ptr(T) & this);
     76        T & *?(unique_ptr(T) & this);
    8677
    87 forall(T &)
    88 void ?=?(unique_ptr(T) & this, unique_ptr(T) that) = void;
    89 forall(T & | { void ^?{}(T &); })
    90 void ?=?(unique_ptr(T) & this, zero_t);
     78        void ?=?(unique_ptr(T) & this, unique_ptr(T) that) = void;
     79        forall( | { void ^?{}(T &); })
     80        void ?=?(unique_ptr(T) & this, zero_t);
    9181
    92 forall(T & | { void ^?{}(T &); })
    93 void move(unique_ptr(T) & this, unique_ptr(T) & that);
     82        forall( | { void ^?{}(T &); })
     83        void move(unique_ptr(T) & this, unique_ptr(T) & that);
    9484
    95 forall(T &)
    96 int ?==?(unique_ptr(T) const & this, unique_ptr(T) const & that);
    97 forall(T &)
    98 int ?!=?(unique_ptr(T) const & this, unique_ptr(T) const & that);
    99 forall(T &)
    100 int ?==?(unique_ptr(T) const & this, zero_t);
    101 forall(T &)
    102 int ?!=?(unique_ptr(T) const & this, zero_t);
     85        int ?==?(unique_ptr(T) const & this, unique_ptr(T) const & that);
     86        int ?!=?(unique_ptr(T) const & this, unique_ptr(T) const & that);
     87        int ?==?(unique_ptr(T) const & this, zero_t);
     88        int ?!=?(unique_ptr(T) const & this, zero_t);
     89}
Note: See TracChangeset for help on using the changeset viewer.