diff --git a/std/algorithm/comparison.d b/std/algorithm/comparison.d index 5eb983f08..e4268dea2 100644 --- a/std/algorithm/comparison.d +++ b/std/algorithm/comparison.d @@ -90,7 +90,7 @@ uint among(alias pred = (a, b) => a == b, Value, Values...) /// Ditto template among(values...) - if (isExpressionTuple!values) + if (isExpressionList!values) { uint among(Value)(Value value) if (!is(CommonType!(Value, values) == void)) @@ -169,8 +169,8 @@ efficient search, but one that only supports matching on equality: // in a tuple. private template indexOfFirstOvershadowingChoiceOnLast(choices...) { - alias firstParameterTypes = ParameterTypeTuple!(choices[0]); - alias lastParameterTypes = ParameterTypeTuple!(choices[$ - 1]); + alias firstParameterTypes = ParameterTypes!(choices[0]); + alias lastParameterTypes = ParameterTypes!(choices[$ - 1]); static if (lastParameterTypes.length == 0) { @@ -254,7 +254,7 @@ auto castSwitch(choices...)(Object switchObject) static assert(isCallable!choice, "A choice handler must be callable"); - alias choiceParameterTypes = ParameterTypeTuple!choice; + alias choiceParameterTypes = ParameterTypes!choice; static assert(choiceParameterTypes.length <= 1, "A choice handler can not have more than one argument."); @@ -270,7 +270,7 @@ auto castSwitch(choices...)(Object switchObject) static assert(indexOfOvershadowingChoice == index, "choice number %d(type %s) is overshadowed by choice number %d(type %s)".format( index + 1, CastClass.stringof, indexOfOvershadowingChoice + 1, - ParameterTypeTuple!(choices[indexOfOvershadowingChoice])[0].stringof)); + ParameterTypes!(choices[indexOfOvershadowingChoice])[0].stringof)); if (classInfo == typeid(CastClass)) { @@ -297,7 +297,7 @@ auto castSwitch(choices...)(Object switchObject) // Checking for derived matches: foreach (choice; choices) { - alias choiceParameterTypes = ParameterTypeTuple!choice; + alias choiceParameterTypes = ParameterTypes!choice; static if (choiceParameterTypes.length == 1) { if (auto castedObject = cast(choiceParameterTypes[0]) switchObject) @@ -327,7 +327,7 @@ auto castSwitch(choices...)(Object switchObject) // Checking for null matches: foreach (index, choice; choices) { - static if (ParameterTypeTuple!(choice).length == 0) + static if (ParameterTypes!(choice).length == 0) { immutable indexOfOvershadowingChoice = indexOfFirstOvershadowingChoiceOnLast!(choices[0..index + 1]); diff --git a/std/concurrency.d b/std/concurrency.d index b19656263..c62d80695 100644 --- a/std/concurrency.d +++ b/std/concurrency.d @@ -150,7 +150,7 @@ private auto map(Op)( Op op ) { - alias Args = ParameterTypeTuple!(Op); + alias Args = ParameterTypes!(Op); static if( Args.length == 1 ) { @@ -171,7 +171,7 @@ private foreach( i, t1; T ) { static assert( isFunctionPointer!t1 || isDelegate!t1 ); - alias a1 = ParameterTypeTuple!(t1); + alias a1 = ParameterTypes!(t1); alias r1 = ReturnType!(t1); static if( i < T.length - 1 && is( r1 == void ) ) @@ -183,7 +183,7 @@ private foreach( t2; T[i+1 .. $] ) { static assert( isFunctionPointer!t2 || isDelegate!t2 ); - alias a2 = ParameterTypeTuple!(t2); + alias a2 = ParameterTypes!(t2); static assert( !is( a1 == a2 ), "function with arguments " ~ a1.stringof ~ @@ -397,8 +397,8 @@ private template isSpawnable(F, T...) { template isParamsImplicitlyConvertible(F1, F2, int i=0) { - alias param1 = ParameterTypeTuple!F1; - alias param2 = ParameterTypeTuple!F2; + alias param1 = ParameterTypes!F1; + alias param2 = ParameterTypes!F2; static if (param1.length != param2.length) enum isParamsImplicitlyConvertible = false; else static if (param1.length == i) @@ -1920,7 +1920,7 @@ private { foreach( i, t; Ops ) { - alias Args = ParameterTypeTuple!(t); + alias Args = ParameterTypes!(t); auto op = ops[i]; if( msg.convertsTo!(Args) ) diff --git a/std/csv.d b/std/csv.d index 3d91f048c..992076d7b 100644 --- a/std/csv.d +++ b/std/csv.d @@ -1066,7 +1066,7 @@ public: scope(exit) colIndex++; if (indices.length > 0) { - foreach(ti, ToType; FieldTypeTuple!(Contents)) + foreach(ti, ToType; FieldTypes!(Contents)) { if (indices[ti] == colIndex) { @@ -1077,7 +1077,7 @@ public: } else { - foreach(ti, ToType; FieldTypeTuple!(Contents)) + foreach(ti, ToType; FieldTypes!(Contents)) { if (ti == colIndex) { diff --git a/std/exception.d b/std/exception.d index b3886896b..bc2370dcb 100644 --- a/std/exception.d +++ b/std/exception.d @@ -1214,7 +1214,7 @@ unittest //To check the class payload itself, iterate on its members: () { - foreach (index, _; FieldTypeTuple!C) + foreach (index, _; FieldTypes!C) if (doesPointTo(a.tupleof[index], i)) return; assert(0); diff --git a/std/functional.d b/std/functional.d index 551991a52..42beb6c82 100644 --- a/std/functional.d +++ b/std/functional.d @@ -87,10 +87,10 @@ private template needOpCallAlias(alias fun) */ static if (is(typeof(fun.opCall) == function)) { - import std.traits : ParameterTypeTuple; + import std.traits : ParameterTypes; enum needOpCallAlias = !is(typeof(fun)) && __traits(compiles, () { - return fun(ParameterTypeTuple!fun.init); + return fun(ParameterTypes!fun.init); }); } else @@ -659,7 +659,7 @@ template partial(alias fun, alias arg) { static if (is(typeof(fun) == delegate) || is(typeof(fun) == function)) { - ReturnType!fun partial(ParameterTypeTuple!fun[1..$] args2) + ReturnType!fun partial(ParameterTypes!fun[1..$] args2) { return fun(arg, args2); } @@ -1024,11 +1024,11 @@ is useful to memoize an impure function, too. */ template memoize(alias fun) { - // alias Args = ParameterTypeTuple!fun; // Bugzilla 13580 + // alias Args = ParameterTypes!fun; // Bugzilla 13580 - ReturnType!fun memoize(ParameterTypeTuple!fun args) + ReturnType!fun memoize(ParameterTypes!fun args) { - alias Args = ParameterTypeTuple!fun; + alias Args = ParameterTypes!fun; import std.typecons : Tuple; static ReturnType!fun[Tuple!Args] memo; @@ -1042,11 +1042,11 @@ template memoize(alias fun) /// ditto template memoize(alias fun, uint maxSize) { - // alias Args = ParameterTypeTuple!fun; // Bugzilla 13580 - ReturnType!fun memoize(ParameterTypeTuple!fun args) + // alias Args = ParameterTypes!fun; // Bugzilla 13580 + ReturnType!fun memoize(ParameterTypes!fun args) { import std.typecons : tuple; - static struct Value { ParameterTypeTuple!fun args; ReturnType!fun res; } + static struct Value { ParameterTypes!fun args; ReturnType!fun res; } static Value[] memo; static size_t[] initialized; @@ -1209,7 +1209,7 @@ private struct DelegateFaker(F) *-------------------- * struct DelegateFaker(F) { * extern(linkage) - * [ref] ReturnType!F doIt(ParameterTypeTuple!F args) [@attributes] + * [ref] ReturnType!F doIt(ParameterTypes!F args) [@attributes] * { * auto fp = cast(F) &this; * return fp(args); @@ -1229,7 +1229,7 @@ private struct DelegateFaker(F) template generateFunctionBody(unused...) { enum generateFunctionBody = - // [ref] ReturnType doIt(ParameterTypeTuple args) @attributes + // [ref] ReturnType doIt(ParameterTypes args) @attributes q{ // When this function gets called, the this pointer isn't // really a this pointer (no instance even really exists), but diff --git a/std/parallelism.d b/std/parallelism.d index ec1096581..7dd1a9e20 100644 --- a/std/parallelism.d +++ b/std/parallelism.d @@ -254,7 +254,7 @@ private template isSafeTask(F) (functionAttributes!F & (FunctionAttribute.safe | FunctionAttribute.trusted)) != 0 && (functionAttributes!F & FunctionAttribute.ref_) == 0 && (isFunctionPointer!F || !hasUnsharedAliasing!F) && - std.meta.algorithm.all!(noUnsharedAliasing, ParameterTypeTuple!F); + std.meta.algorithm.all!(noUnsharedAliasing, ParameterTypes!F); } unittest @@ -2342,9 +2342,9 @@ public: */ auto asyncBuf(C1, C2)(C1 next, C2 empty, size_t initialBufSize = 0, size_t nBuffers = 100) if(is(typeof(C2.init()) : bool) && - ParameterTypeTuple!C1.length == 1 && - ParameterTypeTuple!C2.length == 0 && - isArray!(ParameterTypeTuple!C1[0]) + ParameterTypes!C1.length == 1 && + ParameterTypes!C2.length == 0 && + isArray!(ParameterTypes!C1[0]) ) { auto roundRobin = RoundRobinBuffer!(C1, C2)(next, empty, initialBufSize, nBuffers); return asyncBuf(roundRobin, nBuffers / 2); @@ -3492,7 +3492,7 @@ int doSizeZeroCase(R, Delegate)(ref ParallelForeach!R p, Delegate dg) { foreach(ref ElementType!R elem; range) { - static if(ParameterTypeTuple!dg.length == 2) + static if(ParameterTypes!dg.length == 2) { res = dg(index, elem); } @@ -3508,7 +3508,7 @@ int doSizeZeroCase(R, Delegate)(ref ParallelForeach!R p, Delegate dg) { foreach(ElementType!R elem; range) { - static if(ParameterTypeTuple!dg.length == 2) + static if(ParameterTypes!dg.length == 2) { res = dg(index, elem); } @@ -3532,7 +3532,7 @@ private enum string parallelApplyMixinRandomAccess = q{ } // Whether iteration is with or without an index variable. - enum withIndex = ParameterTypeTuple!(typeof(dg)).length == 2; + enum withIndex = ParameterTypes!(typeof(dg)).length == 2; shared size_t workUnitIndex = size_t.max; // Effectively -1: chunkIndex + 1 == 0 immutable len = range.length; @@ -3587,7 +3587,7 @@ enum string parallelApplyMixinInputRange = q{ } // Whether iteration is with or without an index variable. - enum withIndex = ParameterTypeTuple!(typeof(dg)).length == 2; + enum withIndex = ParameterTypes!(typeof(dg)).length == 2; // This protects the range while copying it. auto rangeMutex = new Mutex(); @@ -3844,7 +3844,7 @@ private struct RoundRobinBuffer(C1, C2) { // No need for constraints because they're already checked for in asyncBuf. - alias Array = ParameterTypeTuple!(C1.init)[0]; + alias Array = ParameterTypes!(C1.init)[0]; alias T = typeof(Array.init[0]); T[][] bufs; diff --git a/std/stdio.d b/std/stdio.d index 767fb11d9..e163476cb 100644 --- a/std/stdio.d +++ b/std/stdio.d @@ -2595,12 +2595,12 @@ $(D Range) that locks the file and allows fast writing to it. /// ditto void put(C)(C c) @safe if (is(C : const(dchar))) { - import std.traits : ParameterTypeTuple; + import std.traits : ParameterTypes; static auto trustedFPUTC(int ch, _iobuf* h) @trusted { return FPUTC(ch, h); } - static auto trustedFPUTWC(ParameterTypeTuple!FPUTWC[0] ch, _iobuf* h) @trusted + static auto trustedFPUTWC(ParameterTypes!FPUTWC[0] ch, _iobuf* h) @trusted { return FPUTWC(ch, h); } @@ -3656,8 +3656,8 @@ struct lines // if (fileName.length && fclose(f)) // StdioException("Could not close file `"~fileName~"'"); // } - import std.traits : ParameterTypeTuple; - alias Parms = ParameterTypeTuple!(dg); + import std.traits : ParameterTypes; + alias Parms = ParameterTypes!(dg); static if (isSomeString!(Parms[$ - 1])) { enum bool duplicate = is(Parms[$ - 1] == string) @@ -3702,9 +3702,9 @@ struct lines { import std.exception : assumeUnique; import std.conv : to; - import std.traits : ParameterTypeTuple; + import std.traits : ParameterTypes; - alias Parms = ParameterTypeTuple!(dg); + alias Parms = ParameterTypes!(dg); enum duplicate = is(Parms[$ - 1] : immutable(ubyte)[]); int result = 1; int c = void; diff --git a/std/string.d b/std/string.d index df2c4aab5..57ab7a0fb 100644 --- a/std/string.d +++ b/std/string.d @@ -2067,8 +2067,8 @@ auto representation(Char)(Char[] s) @safe pure nothrow @nogc Tuple!(wchar, ushort), Tuple!(dchar, uint ))) { - alias Char = FieldTypeTuple!Type[0]; - alias Int = FieldTypeTuple!Type[1]; + alias Char = FieldTypes!Type[0]; + alias Int = FieldTypes!Type[1]; enum immutable(Char)[] hello = "hello"; test!( immutable Char, immutable Int)(hello); diff --git a/std/traits.d b/std/traits.d index a45a24393..cb67ded23 100644 --- a/std/traits.d +++ b/std/traits.d @@ -896,9 +896,10 @@ unittest } /*** -Get, as a $(D MetaList), the types of the parameters to a function, a pointer -to function, a delegate, a struct with an $(D opCall), a pointer to a -struct with an $(D opCall), or a class with an $(D opCall). +Get, as a $(XREF meta.list, MetaList), the types of the parameters to a +function, a pointer to function, a delegate, a struct with +an $(D opCall), a pointer to a struct with an $(D opCall), or a class +with an $(D opCall). */ template ParameterTypes(func...) if (func.length == 1 && isCallable!func) @@ -965,8 +966,8 @@ unittest { } /** -Returns a tuple consisting of the storage classes of the parameters of a -function $(D func). +Returns a $(XREF meta.list, MetaList) consisting of the storage classes +off the parameters of a function $(D func). */ enum ParameterStorageClass : uint { @@ -997,7 +998,7 @@ template ParameterStorageClasses(func...) // chop off CallConvention and FuncAttrs enum margs = demangleFunctionAttributes(mangledName!Func[1 .. $]).rest; - // demangle Arguments and store parameter storage classes in a tuple + // demangle Arguments and store parameter storage classes in a list template demangleNextParameter(string margs, size_t i = 0) { static if (i < Params.length) @@ -1092,7 +1093,8 @@ unittest /** -Get, as a tuple, the identifiers of the parameters to a function symbol. +Get, as a $(XREF meta.list, MetaList), the identifiers of the parameters +to a function symbol. */ template ParameterIdentifiers(func...) if (func.length == 1 && isCallable!func) @@ -1181,7 +1183,8 @@ unittest /** -Get, as a tuple, the default value of the parameters to a function symbol. +Get, as a $(XREF meta.list, MetaList), the default value of the parameters +to a function symbol. If a parameter doesn't have the default value, $(D void) is returned instead. */ template ParameterDefaultValues(func...) @@ -2170,11 +2173,13 @@ unittest /*** - * Get as a typetuple the types of the fields of a struct, class, or union. + * Get as a $(XREF meta.list, MetaList) the types of the fields of a struct, + * class, or union. + * * This consists of the fields that take up memory space, * excluding the hidden fields like the virtual function * table pointer or a context pointer for nested types. - * If $(D T) isn't a struct, class, or union returns typetuple + * If $(D T) isn't a struct, class, or union returns type list * with one element $(D T). */ template FieldTypes(T) @@ -2224,11 +2229,11 @@ unittest private enum NameOf(alias T) = T.stringof; /** - * Get as an expression tuple the names of the fields of a struct, class, or + * Get as an expression list the names of the fields of a struct, class, or * union. This consists of the fields that take up memory space, excluding the * hidden fields like the virtual function table pointer or a context pointer * for nested types. If $(D T) isn't a struct, class, or union returns an - * expression tuple with an empty string. + * expression list with an empty string. */ template FieldNames(T) { @@ -3340,13 +3345,13 @@ Params: E = An enumerated type. $(D E) may have duplicated values. Returns: - Static tuple composed of the members of the enumerated type $(D E). + Expression list composed of the members of the enumerated type $(D E). The members are arranged in the same order as declared in $(D E). Note: An enum can have multiple members which have the same value. If you want to use EnumMembers to e.g. generate switch cases at compile-time, - you should use the $(XREF typetuple, NoDuplicates) template to avoid + you should use the $(XREF meta.list, NoDuplicates) template to avoid generating duplicate switch cases. Note: @@ -3488,7 +3493,7 @@ unittest /*** * Get a $(D_PARAM MetaList) of the base class and base interfaces of * this class or interface. $(D_PARAM BaseTypes!Object) returns - * the empty type tuple. + * the empty type list. */ template BaseTypes(A) { @@ -3533,7 +3538,7 @@ unittest /** * Get a $(D_PARAM MetaList) of $(I all) base classes of this class, * in decreasing order. Interfaces are not included. $(D_PARAM - * BaseClasses!Object) yields the empty type tuple. + * BaseClasses!Object) yields the empty type list. */ template BaseClasses(T) if (is(T == class)) @@ -3585,7 +3590,7 @@ unittest * Get a $(D_PARAM MetaList) of $(I all) interfaces directly or * indirectly inherited by this class or interface. Interfaces do not * repeat if multiply implemented. $(D_PARAM Interfaces!Object) - * yields the empty type tuple. + * yields the empty type list. */ template Interfaces(T) { @@ -3648,7 +3653,7 @@ unittest * Get a $(D_PARAM MetaList) of $(I all) base classes of $(D_PARAM * T), in decreasing order, followed by $(D_PARAM T)'s * interfaces. $(D_PARAM TransitiveBaseTypes!Object) yields the - * empty type tuple. + * empty type list. */ template TransitiveBaseTypes(T) { @@ -3683,8 +3688,10 @@ unittest /** -Returns a tuple of non-static functions with the name $(D name) declared in the -class or interface $(D C). Covariant duplicates are shrunk into the most +Returns a symbol list of non-static functions with the name $(D name) +declared in the class or interface $(D C). + +Covariant duplicates are shrunk into the most derived one. */ template MemberFunctions(C, string name) @@ -3724,7 +3731,7 @@ template MemberFunctions(C, string name) alias MetaList!() CollectOverloads; // no overloads in this hierarchy } - // duplicates in this tuple will be removed by shrink() + // duplicates in this list will be removed by shrink() alias CollectOverloads!C overloads; // shrinkOne!args[0] = the most derived one in the covariant siblings of target @@ -3884,7 +3891,8 @@ unittest /** -Returns a $(D MetaList) of the template arguments used to instantiate $(D T). +Returns a $(XREF meta.list, MetaList) of the template arguments used +to instantiate $(D T). */ template TemplateArgsOf(alias T : Base!Args, alias Base, Args...) { @@ -4017,7 +4025,7 @@ unittest /** - * Returns a tuple with all possible target types of an implicit + * Returns a type list with all possible target types of an implicit * conversion of a value of type $(D_PARAM T). * * Important note: @@ -5542,7 +5550,7 @@ unittest /** * Check whether $(D T) is an expression list. - * An expression list is kind of compile-time list (also $(D MetaList)) + * An expression list is kind of compile-time list (see $(XREF meta.list, MetaList)) * that only contains expressions. * * See_Also: $(LREF isTypeList). @@ -5593,7 +5601,7 @@ unittest /** * Check whether $(D T) is a type list. - * A type list is kind of compile-time list (also $(D MetaList)) + * A type list is kind of compile-time list (see $(XREF meta.list, MetaList)) * that only contains types. * * See_Also: $(LREF isExpressionList). diff --git a/std/typecons.d b/std/typecons.d index ca2441ac5..e482fed9f 100644 --- a/std/typecons.d +++ b/std/typecons.d @@ -410,7 +410,7 @@ for the second, and so on. The choice of zero-based indexing instead of one-base indexing was motivated by the ability to use value `Tuple`s with various compile-time -loop constructs (e.g. $(XREF typetuple, MetaList) iteration), all of which use +loop constructs (e.g. $(XREF meta.list, MetaList) iteration), all of which use zero-based indexing. Params: @@ -1909,13 +1909,13 @@ Returns: { return _isNull; } - + /// unittest { Nullable!int ni; assert(ni.isNull); - + ni = 0; assert(!ni.isNull); } @@ -1928,13 +1928,13 @@ Forces $(D this) to the null state. .destroy(_value); _isNull = true; } - + /// unittest { Nullable!int ni = 0; assert(!ni.isNull); - + ni.nullify(); assert(ni.isNull); } @@ -1956,7 +1956,7 @@ Params: If this `Nullable` wraps a type that already has a null value (such as a pointer), then assigning the null value to this `Nullable` is no different than assigning any other value of - type `T`, and the resulting code will look very strange. It + type `T`, and the resulting code will look very strange. It is strongly recommended that this be avoided by instead using the version of `Nullable` that takes an additional `nullValue` template argument. @@ -1966,7 +1966,7 @@ unittest //Passes Nullable!(int*) npi; assert(npi.isNull); - + //Passes?! npi = null; assert(!npi.isNull); @@ -1985,17 +1985,17 @@ Returns: assert(!isNull, message); return _value; } - + /// unittest { import std.exception: assertThrown, assertNotThrown; - + Nullable!int ni; - //`get` is implicitly called. Will throw + //`get` is implicitly called. Will throw //an AssertError in non-release mode assertThrown!Throwable(ni == 0); - + ni = 0; assertNotThrown!Throwable(ni == 0); } @@ -2016,21 +2016,21 @@ unittest string address; int customerNum; } - + Nullable!CustomerRecord getByName(string name) { //A bunch of hairy stuff - + return Nullable!CustomerRecord.init; } - + auto queryResult = getByName("Doe, John"); if (!queryResult.isNull) { //Process Mr. Doe's customer record auto address = queryResult.address; auto customerNum = queryResult.customerNum; - + //Do some things with this customer's info } else @@ -2320,7 +2320,7 @@ Nullable!T) because it does not need to store an extra $(D bool). Params: T = The wrapped type for which Nullable provides a null value. - + nullValue = The null value which denotes the null state of this `Nullable`. Must be of type `T`. */ @@ -2375,14 +2375,14 @@ Returns: return _value == nullValue; } } - + /// unittest { Nullable!(int, -1) ni; //Initialized to "null" state assert(ni.isNull); - + ni = 0; assert(!ni.isNull); } @@ -2394,20 +2394,20 @@ Forces $(D this) to the null state. { _value = nullValue; } - + /// unittest { Nullable!(int, -1) ni = 0; assert(!ni.isNull); - + ni = -1; assert(ni.isNull); } /** Assigns $(D value) to the internally-held state. If the assignment -succeeds, $(D this) becomes non-null. No null checks are made. Note +succeeds, $(D this) becomes non-null. No null checks are made. Note that the assignment may leave $(D this) in the null state. Params: @@ -2419,13 +2419,13 @@ Params: { _value = value; } - + /** If this `Nullable` wraps a type that already has a null value (such as a pointer), and that null value is not given for - `nullValue`, then assigning the null value to this `Nullable` - is no different than assigning any other value of type `T`, - and the resulting code will look very strange. It is strongly + `nullValue`, then assigning the null value to this `Nullable` + is no different than assigning any other value of type `T`, + and the resulting code will look very strange. It is strongly recommended that this be avoided by using `T`'s "built in" null value for `nullValue`. */ @@ -2435,7 +2435,7 @@ unittest enum nullVal = cast(int*)0xCAFEBABE; Nullable!(int*, nullVal) npi; assert(npi.isNull); - + //Passes?! npi = null; assert(!npi.isNull); @@ -2456,17 +2456,17 @@ Returns: assert(!isNull, message); return _value; } - + /// unittest { import std.exception: assertThrown, assertNotThrown; - + Nullable!(int, -1) ni; - //`get` is implicitly called. Will throw + //`get` is implicitly called. Will throw //an error in non-release mode assertThrown!Throwable(ni == 0); - + ni = 0; assertNotThrown!Throwable(ni == 0); } @@ -2484,14 +2484,14 @@ unittest Nullable!(size_t, size_t.max) indexOf(string[] haystack, string needle) { //Find the needle, returning -1 if not found - + return Nullable!(size_t, size_t.max).init; } - + void sendLunchInvite(string name) { } - + //It's safer than C... auto coworkers = ["Jane", "Jim", "Marry", "Fred"]; auto pos = indexOf(coworkers, "Bob"); @@ -2504,7 +2504,7 @@ unittest { //Bob not found; report the error } - + //And there's no overhead static assert(Nullable!(size_t, size_t.max).sizeof == size_t.sizeof); } @@ -2683,13 +2683,13 @@ Params: { _value = value; } - + /// unittest { NullableRef!int nr = new int(42); assert(nr == 42); - + int* n = new int(1); nr.bind(n); assert(nr == 1); @@ -2705,13 +2705,13 @@ Returns: { return _value is null; } - + /// unittest { NullableRef!int nr; assert(nr.isNull); - + int* n = new int(42); nr.bind(n); assert(!nr.isNull && nr == 42); @@ -2724,13 +2724,13 @@ Forces $(D this) to the null state. { _value = null; } - + /// unittest { NullableRef!int nr = new int(42); assert(!nr.isNull); - + nr.nullify(); assert(nr.isNull); } @@ -2751,16 +2751,16 @@ Params: assert(!isNull, message); *_value = value; } - + /// unittest { import std.exception: assertThrown, assertNotThrown; - + NullableRef!int nr; assert(nr.isNull); assertThrown!Throwable(nr = 42); - + nr.bind(new int(0)); assert(!nr.isNull); assertNotThrown!Throwable(nr = 42); @@ -2777,17 +2777,17 @@ This function is also called for the implicit conversion to $(D T). assert(!isNull, message); return *_value; } - + /// unittest { import std.exception: assertThrown, assertNotThrown; - + NullableRef!int nr; - //`get` is implicitly called. Will throw + //`get` is implicitly called. Will throw //an error in non-release mode assertThrown!Throwable(nr == 0); - + nr.bind(new int(0)); assertNotThrown!Throwable(nr == 0); } @@ -3021,8 +3021,8 @@ unittest /** $(D WhiteHole!Base) is a subclass of $(D Base) which automatically implements -all abstract member functions as functions that always fail. These functions -simply throw an $(D Error) and never return. `Whitehole` is useful for +all abstract member functions as functions that always fail. These functions +simply throw an $(D Error) and never return. `Whitehole` is useful for trapping the use of class member functions that haven't been implemented. The name came from @@ -3203,7 +3203,7 @@ private static: import std.meta : Filter; static if (names.length > 0) { - alias methods = Filter!(pred, MemberFunctionsTuple!(C, names[0])); + alias methods = Filter!(pred, MemberFunctions!(C, names[0])); alias next = Impl!(names[1 .. $]); static if (methods.length > 0) @@ -3498,13 +3498,13 @@ Used by MemberFunctionGenerator. */ package template FuncInfo(alias func, /+[BUG 4217 ?]+/ T = typeof(&func)) { - alias RT = ReturnType!T; - alias PT = ParameterTypeTuple!T; + alias RT = ReturnType!T; + alias PT = ParameterTypes!T; } package template FuncInfo(Func) { - alias RT = ReturnType!Func; - alias PT = ParameterTypeTuple!Func; + alias RT = ReturnType!Func; + alias PT = ParameterTypes!Func; } /* @@ -3700,7 +3700,7 @@ private static: /*** Function Body ***/ code ~= "{\n"; { - enum nparams = ParameterTypeTuple!(func).length; + enum nparams = ParameterTypes!(func).length; /* Declare keywords: args, self and parent. */ string preamble; @@ -3737,7 +3737,7 @@ private static: private GenParams generateParameters(string myFuncInfo, func...)() { alias STC = ParameterStorageClass; - alias stcs = ParameterStorageClassTuple!(func); + alias stcs = ParameterStorageClasses!(func); enum nparams = stcs.length; string imports = ""; // any imports required @@ -4032,7 +4032,7 @@ if (Targets.length >= 1 && std.meta.algorithm.all!(isMutable, Targets)) enum n = to!string(i); static if (fa & FunctionAttribute.property) { - static if (ParameterTypeTuple!(TargetMembers[i].type).length == 0) + static if (ParameterTypes!(TargetMembers[i].type).length == 0) enum fbody = "_wrap_source."~name; else enum fbody = "_wrap_source."~name~" = forward!args"; @@ -4043,7 +4043,7 @@ if (Targets.length >= 1 && std.meta.algorithm.all!(isMutable, Targets)) } enum generateFun = "override "~stc~"ReturnType!(TargetMembers["~n~"].type) " - ~ name~"(ParameterTypeTuple!(TargetMembers["~n~"].type) args) "~mod~ + ~ name~"(ParameterTypes!(TargetMembers["~n~"].type) args) "~mod~ "{ return "~fbody~"; }"; } @@ -4340,7 +4340,7 @@ private template findCovariantFunction(alias finfo, Source, Fs...) enum x = check!(); static if (x == -1 && is(typeof(Source.opDispatch))) { - alias Params = ParameterTypeTuple!(finfo.type); + alias Params = ParameterTypes!(finfo.type); enum ptrdiff_t findCovariantFunction = is(typeof(( Source).init.opDispatch!(finfo.name)(Params.init))) || is(typeof(( const Source).init.opDispatch!(finfo.name)(Params.init))) || @@ -4452,8 +4452,8 @@ private template DerivedFunctionType(T...) { alias FA = FunctionAttribute; - alias F0 = T[0], R0 = ReturnType!F0, PSTC0 = ParameterStorageClassTuple!F0; - alias F1 = T[1], R1 = ReturnType!F1, PSTC1 = ParameterStorageClassTuple!F1; + alias F0 = T[0], R0 = ReturnType!F0, PSTC0 = ParameterStorageClasses!F0; + alias F1 = T[1], R1 = ReturnType!F1, PSTC1 = ParameterStorageClasses!F1; enum FA0 = functionAttributes!F0; enum FA1 = functionAttributes!F1; diff --git a/std/variant.d b/std/variant.d index 5665b8309..2a7296730 100644 --- a/std/variant.d +++ b/std/variant.d @@ -517,7 +517,7 @@ private: } else { - alias ParamTypes = ParameterTypeTuple!A; + alias ParamTypes = ParameterTypes!A; auto p = cast(Variant*) parm; auto argCount = p.get!size_t; // To assign the tuple we need to use the unqualified version, @@ -1197,7 +1197,7 @@ public: */ int opApply(Delegate)(scope Delegate dg) if (is(Delegate == delegate)) { - alias A = ParameterTypeTuple!(Delegate)[0]; + alias A = ParameterTypes!(Delegate)[0]; if (type == typeid(A[])) { auto arr = get!(A[]); @@ -2207,7 +2207,7 @@ private auto visitImpl(bool Strict, VariantType, Handler...)(VariantType variant // Handle normal function objects static if (isSomeFunction!dg) { - alias Params = ParameterTypeTuple!dg; + alias Params = ParameterTypes!dg; static if (Params.length == 0) { // Just check exception functions in the first