Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/memory.cfa

    r85871478 rfd54fef  
    1010// Created On       : Tue Jun  2 16:48:00 2020
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Feb  1 16:10:00 2021
    13 // Update Count     : 1
     12// Last Modified On : Tue Jun  3 12:30:00 2020
     13// Update Count     : 0
    1414//
    1515
     
    5656}
    5757
    58 forall(T & | sized(T))
     58forall(T & | sized(T) | { void ^?{}(T &); })
    5959void ?{}(counter_ptr(T) & this, counter_ptr(T) that) {
    6060        // `that` is a copy but it should have neither a constructor
    6161        // nor destructor run on it so it shouldn't need adjustment.
     62        internal_decrement(this);
    6263        internal_copy(this, that);
    6364}
     
    6566forall(T & | sized(T), Args... | { void ?{}(T&, Args); })
    6667void ?{}(counter_ptr(T) & this, Args args) {
    67         this.data = malloc();
    68         this.data->counter = 1;
    69         (this.data->object){args};
     68        this.data = (counter_data(T)*)new(args);
    7069}
    7170
     
    127126forall(T & | sized(T), Args... | { void ?{}(T &, Args); })
    128127void ?{}(unique_ptr(T) & this, Args args) {
    129         this.data = malloc();
    130         (*this.data){args};
     128        this.data = (T *)new(args);
    131129}
    132130
Note: See TracChangeset for help on using the changeset viewer.