Changeset 1665ee5 for libcfa


Ignore:
Timestamp:
Sep 11, 2024, 4:49:07 PM (3 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
05f8761
Parents:
6325bd4
Message:

Add uArray delayed-initialization equivalent to CFA array

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/collections/array.hfa

    r6325bd4 r1665ee5  
    156156//      other two.  This solution offers ?{}() that needs only ?{}(), and similar for ^?{}.
    157157
     158// skip initializing elements
     159//   array(float, 5) x = { delay_init };
     160struct delay_init_t {} delay_init;
     161forall( [N], S & | sized(S), Timmed &, Tbase & )
     162static inline void ?{}( arpk( N, S, Timmed, Tbase ) & this, delay_init_t ) {
     163        void ?{}( S (&)[N] ) {}
     164        ?{}(this.strides);
     165}
     166
     167// call default ctor on elements
     168//   array(float, 5) x;
    158169forall( [N], S & | sized(S), Timmed &, Tbase & | { void ?{}( Timmed & ); } )
    159170static inline void ?{}( arpk( N, S, Timmed, Tbase ) & this ) { 
    160         void ?{}( S (&)[N] ) {}
    161         ?{}(this.strides);
    162 
     171        ?{}( this, delay_init );
    163172        for (i; N) ?{}( (Timmed &)this.strides[i] );
    164173}
     
    173182        }
    174183}
     184
    175185
    176186//
Note: See TracChangeset for help on using the changeset viewer.