Changeset 8be729f for libcfa/src/memory.hfa
 Timestamp:
 Feb 1, 2021, 4:23:55 PM (3 years ago)
 Branches:
 ADT, armeh, astexperimental, enum, forallpointerdecay, jacob/cs343translation, master, newastuniqueexpr, pthreademulation, qualifiedEnum
 Children:
 85871478
 Parents:
 f99f5ba
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

libcfa/src/memory.hfa
rf99f5ba r8be729f 10 10 // Created On : Tue Jun 2 16:48:00 2020 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Jun 3 12:29:00 202013 // Update Count : 012 // Last Modified On : Fri Jan 29 15:52:00 2021 13 // Update Count : 1 14 14 // 15 15 … … 17 17 18 18 // Internal data object. 19 forall(T &  sized(T)) {20 21 22 23 19 forall(T &  sized(T)) 20 struct counter_data { 21 unsigned int counter; 22 T object; 23 }; 24 24 25 forall(Args...  { void ?{}(T &, Args); })26 25 forall(T &  sized(T), Args...  { void ?{}(T &, Args); }) 26 void ?{}(counter_data(T) & this, Args args); 27 27 28 forall(  { void ^?{}(T &); }) 29 void ^?{}(counter_data(T) & this); 30 } 28 forall(T &  sized(T)  { void ^?{}(T &); }) 29 void ^?{}(counter_data(T) & this); 31 30 32 31 // This is one of many pointers keeping this alive. 33 forall(T &  sized(T)) {34 35 36 32 forall(T &  sized(T)) 33 struct counter_ptr { 34 counter_data(T) * data; 35 }; 37 36 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); 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); 44 45 45 forall( { void ^?{}(T &); })46 46 forall(T &  sized(T)  { void ^?{}(T &); }) 47 void ^?{}(counter_ptr(T) & this); 47 48 48 T & *?(counter_ptr(T) & this); 49 forall(T &  sized(T)) 50 T & *?(counter_ptr(T) & this); 49 51 50 forall( { void ^?{}(T &); })51 52 forall( { void ^?{}(T &); })53 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); 54 56 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 } 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); 60 65 61 66 // This is the only pointer that keeps this alive. 62 forall(T &) {63 64 65 67 forall(T &) 68 struct unique_ptr { 69 T * data; 70 }; 66 71 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); 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); 72 80 73 forall( { void ^?{}(T &); })74 81 forall(T &  { void ^?{}(T &); }) 82 void ^?{}(unique_ptr(T) & this); 75 83 76 T & *?(unique_ptr(T) & this); 84 forall(T & ) 85 T & *?(unique_ptr(T) & this); 77 86 78 void ?=?(unique_ptr(T) & this, unique_ptr(T) that) = void; 79 forall(  { void ^?{}(T &); }) 80 void ?=?(unique_ptr(T) & this, zero_t); 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); 81 91 82 forall( { void ^?{}(T &); })83 92 forall(T &  { void ^?{}(T &); }) 93 void move(unique_ptr(T) & this, unique_ptr(T) & that); 84 94 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 } 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);
Note: See TracChangeset
for help on using the changeset viewer.