Changes in libcfa/src/memory.hfa [8be729f:fd54fef]
- File:
-
- 1 edited
-
libcfa/src/memory.hfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/memory.hfa
r8be729f rfd54fef 10 10 // Created On : Tue Jun 2 16:48:00 2020 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jan 29 15:52:00 202113 // Update Count : 112 // Last Modified On : Tue Jun 3 12:29:00 2020 13 // Update Count : 0 14 14 // 15 15 … … 17 17 18 18 // Internal data object. 19 forall(T & | sized(T)) 20 struct counter_data {21 unsigned int counter;22 T object;23 };19 forall(T & | sized(T)) { 20 struct counter_data { 21 unsigned int counter; 22 T object; 23 }; 24 24 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); 27 27 28 forall(T & | sized(T) | { void ^?{}(T &); }) 29 void ^?{}(counter_data(T) & this); 28 forall( | { void ^?{}(T &); }) 29 void ^?{}(counter_data(T) & this); 30 } 30 31 31 32 // This is one of many pointers keeping this alive. 32 forall(T & | sized(T)) 33 struct counter_ptr {34 counter_data(T) * data;35 };33 forall(T & | sized(T)) { 34 struct counter_ptr { 35 counter_data(T) * data; 36 }; 36 37 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); 45 44 46 forall(T & | sized(T)| { void ^?{}(T &); })47 void ^?{}(counter_ptr(T) & this);45 forall( | { void ^?{}(T &); }) 46 void ^?{}(counter_ptr(T) & this); 48 47 49 forall(T & | sized(T)) 50 T & *?(counter_ptr(T) & this); 48 T & *?(counter_ptr(T) & this); 51 49 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); 56 54 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 } 65 60 66 61 // This is the only pointer that keeps this alive. 67 forall(T &) 68 struct unique_ptr {69 T * data;70 };62 forall(T &) { 63 struct unique_ptr { 64 T * data; 65 }; 71 66 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); 80 72 81 forall(T &| { void ^?{}(T &); })82 void ^?{}(unique_ptr(T) & this);73 forall( | { void ^?{}(T &); }) 74 void ^?{}(unique_ptr(T) & this); 83 75 84 forall(T & ) 85 T & *?(unique_ptr(T) & this); 76 T & *?(unique_ptr(T) & this); 86 77 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); 91 81 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); 94 84 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.