Changeset 150 for trunk

Show
Ignore:
Timestamp:
06/04/08 22:26:41 (4 months ago)
Author:
baxissimo
Message:

Strike that last change. Instead of making zero,identity const,
Make new static const versions called "czero" and "cidentity".
The problem is that you can't use a const as a ref parameter (in D1 at least).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/LinAlg/linalg/MatrixT.d

    r149 r150  
    7070 
    7171    /// Compile-time const identity matrix. 
    72     mixin(_gen_identity_matrix!(M,N)()) ; 
     72    mixin(_gen_identity_matrix!(M,N)("static", "identity")) ; 
     73    mixin(_gen_identity_matrix!(M,N)("static const", "cidentity")) ; 
    7374 
    7475    /// Compile-time const matrix with all elements set to 0. 
    75     mixin(_gen_zero_matrix!(M,N)()) ; 
     76    mixin(_gen_zero_matrix!(M,N)("static", "zero")) ; 
     77    mixin(_gen_zero_matrix!(M,N)("static const", "czero")) ; 
    7678 
    7779 
     
    765767 
    766768 
    767 private string _gen_identity_matrix(int M, int N)() { 
    768     string ret = "static const MatrixT identity = {[cast(T)"; 
     769private string _gen_identity_matrix(int M, int N)(string storage_class, string name) { 
     770    string ret = storage_class ~" MatrixT "~name~" = {[cast(T)"; 
    769771    for(int col=0; col<N; ++col) { 
    770772        for (int row=0; row<M; ++row) { 
     
    776778} 
    777779 
    778 private string _gen_zero_matrix(int M, int N)() { 
    779     string ret = "static const MatrixT zero = {[cast(T)"; 
     780private string _gen_zero_matrix(int M, int N)(string storage_class, string name) { 
     781    string ret = storage_class ~" MatrixT "~name~" = {[cast(T)"; 
    780782    for(int col=0; col<N; ++col) { 
    781783        for (int row=0; row<M; ++row) { 
  • trunk/LinAlg/linalg/VectorT.d

    r149 r150  
    6868} 
    6969 
    70 private string _gen_zero_vector(int N)() { 
    71     string ret = "static const VectorT zero = {[cast(T)"; 
     70private string _gen_zero_vector(int N)(string storage_class, string name) { 
     71    string ret = storage_class ~" VectorT "~name~" = {[cast(T)"; 
    7272    for(int col=0; col<N; ++col) { 
    7373        ret ~= "0,"; 
     
    151151 
    152152    //-------------------------------------------------------------- constructors 
    153     /// Compile-time const vector with all elements set to 0. 
     153    /// Compile-time static vectors with all elements set to 0. 
    154154    // static VectorT zero = {0,0,0...} 
    155     mixin(_gen_zero_vector!(N)()) ; 
     155    // static const VectorT zero = {0,0,0...} 
     156    mixin(_gen_zero_vector!(N)("static", "zero")); 
     157    mixin(_gen_zero_vector!(N)("static const", "czero")); 
    156158 
    157159    /// default constructor creates uninitialized values.