Changeset 1709
- Timestamp:
- 07/02/10 18:54:51 (14 years ago)
- Files:
-
- trunk/phobos/std/traits.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/std/traits.d
r1705 r1709 859 859 private template HasRawLocalPointerImpl(T...) 860 860 { 861 861 static if (T.length == 0) 862 862 { 863 863 enum result = false; 864 864 } 865 865 else 866 866 { 867 867 static if (is(T[0] foo : U*, U)) 868 868 enum hasRawLocalAliasing = !is(U == immutable) && !is(U == shared); 869 else static if (is(T[0] foo : U[], U) )869 else static if (is(T[0] foo : U[], U) && !isStaticArray!(T[0])) 870 870 enum hasRawLocalAliasing = !is(U == immutable) && !is(U == shared); 871 871 else 872 872 enum hasRawLocalAliasing = false; 873 873 enum result = hasRawLocalAliasing || HasRawLocalPointerImpl!(T[1 .. $]).result; 874 874 } 875 875 } 876 876 877 877 /* 878 878 Statically evaluates to $(D true) if and only if $(D T)'s 879 879 representation contains at least one field of pointer or array type. … … 1130 1130 static assert(!hasLocalAliasing!(S2)); 1131 1131 struct S3 { int a; immutable Object b; } 1132 1132 static assert(!hasLocalAliasing!(S3)); 1133 1133 1134 1134 struct S4 { int a; shared Object b; } 1135 1135 static assert(!hasLocalAliasing!(S4)); 1136 1136 struct S5 { char[] a; } 1137 1137 static assert(hasLocalAliasing!(S5)); 1138 1138 struct S6 { shared char[] b; } 1139 1139 static assert(!hasLocalAliasing!(S6)); 1140 struct S7 { float[3] vals; } 1141 static assert(!hasLocalAliasing!(S7)); 1140 1142 } 1141 1143 1142 1144 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// 1143 1145 // Classes and Interfaces 1144 1146 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::// 1145 1147 1146 1148 /*** 1147 1149 * Get a $(D_PARAM TypeTuple) of the base class and base interfaces of 1148 1150 * this class or interface. $(D_PARAM BaseTypeTuple!(Object)) returns 1149 1151 * the empty type tuple.
