mirror of
https://github.com/dlang/phobos.git
synced 2025-04-26 13:10:35 +03:00
import std.typetuple -> import std.meta
This commit is contained in:
parent
d689291080
commit
73f773838d
43 changed files with 172 additions and 172 deletions
|
@ -132,7 +132,7 @@ efficient search, but one that only supports matching on equality:
|
|||
|
||||
@safe unittest
|
||||
{
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
if (auto pos = 3.among(1, 2, 3))
|
||||
assert(pos == 3);
|
||||
|
|
|
@ -294,7 +294,7 @@ private struct _Cache(R, bool bidir)
|
|||
private
|
||||
{
|
||||
import std.algorithm.internal : algoFormat;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
alias E = ElementType!R;
|
||||
alias UE = Unqual!E;
|
||||
|
@ -430,14 +430,14 @@ template map(fun...) if (fun.length >= 1)
|
|||
{
|
||||
auto map(Range)(Range r) if (isInputRange!(Unqual!Range))
|
||||
{
|
||||
import std.typetuple : staticMap;
|
||||
import std.meta : staticMap;
|
||||
|
||||
alias AppliedReturnType(alias f) = typeof(f(r.front));
|
||||
|
||||
static if (fun.length > 1)
|
||||
{
|
||||
import std.functional : adjoin;
|
||||
import std.typetuple : staticIndexOf;
|
||||
import std.meta : staticIndexOf;
|
||||
|
||||
alias _funs = staticMap!(unaryFun, fun);
|
||||
alias _fun = adjoin!_funs;
|
||||
|
@ -817,7 +817,7 @@ See_Also: $(XREF range,tee)
|
|||
*/
|
||||
template each(alias pred = "a")
|
||||
{
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
alias BinaryArgs = TypeTuple!(pred, "i", "a");
|
||||
|
||||
enum isRangeUnaryIterable(R) =
|
||||
|
@ -2445,7 +2445,7 @@ See_Also:
|
|||
+/
|
||||
template reduce(fun...) if (fun.length >= 1)
|
||||
{
|
||||
import std.typetuple : staticMap;
|
||||
import std.meta : staticMap;
|
||||
|
||||
alias binfuns = staticMap!(binaryFun, fun);
|
||||
static if (fun.length > 1)
|
||||
|
@ -3756,7 +3756,7 @@ if (isSomeChar!C)
|
|||
@safe pure unittest
|
||||
{
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
foreach(S; TypeTuple!(string, wstring, dstring))
|
||||
{
|
||||
import std.conv : to;
|
||||
|
|
|
@ -736,7 +736,7 @@ unittest
|
|||
{
|
||||
import std.algorithm.iteration : filter;
|
||||
import std.traits : hasElaborateAssign;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
debug(std_algorithm) scope(success)
|
||||
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
||||
|
|
|
@ -481,7 +481,7 @@ if (isNarrowString!R1 && isNarrowString!R2)
|
|||
import std.exception : assertThrown;
|
||||
import std.utf : UTFException;
|
||||
import std.range;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
assert(commonPrefix([1, 2, 3], [1, 2, 3, 4, 5]) == [1, 2, 3]);
|
||||
assert(commonPrefix([1, 2, 3, 4, 5], [1, 2, 3]) == [1, 2, 3]);
|
||||
|
@ -1065,7 +1065,7 @@ if (isBidirectionalRange!R &&
|
|||
@safe unittest
|
||||
{
|
||||
import std.algorithm.iteration : filterBidirectional;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
import std.conv : to;
|
||||
|
||||
debug(std_algorithm) scope(success)
|
||||
|
@ -1367,7 +1367,7 @@ if (isInputRange!InputRange &&
|
|||
|
||||
@safe pure unittest
|
||||
{
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
foreach(R; TypeTuple!(string, wstring, dstring))
|
||||
{
|
||||
foreach(E; TypeTuple!(char, wchar, dchar))
|
||||
|
@ -1411,7 +1411,7 @@ if (isInputRange!InputRange &&
|
|||
@safe unittest
|
||||
{
|
||||
import std.exception : assertCTFEable;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
void dg() @safe pure nothrow
|
||||
{
|
||||
|
@ -1959,7 +1959,7 @@ if (Ranges.length > 1 && is(typeof(startsWith!pred(haystack, needles))))
|
|||
@safe unittest
|
||||
{
|
||||
import std.algorithm.internal : rndstuff;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
import std.uni : toUpper;
|
||||
|
||||
debug(std_algorithm) scope(success)
|
||||
|
@ -1992,7 +1992,7 @@ if (Ranges.length > 1 && is(typeof(startsWith!pred(haystack, needles))))
|
|||
import std.algorithm.internal : rndstuff;
|
||||
import std.algorithm.comparison : equal;
|
||||
import std.range : retro;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
debug(std_algorithm) scope(success)
|
||||
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
||||
|
@ -2090,7 +2090,7 @@ $(LREF among) for checking a value against multiple possibilities.
|
|||
+/
|
||||
template canFind(alias pred="a == b")
|
||||
{
|
||||
import std.typetuple : allSatisfy;
|
||||
import std.meta : allSatisfy;
|
||||
|
||||
/++
|
||||
Returns $(D true) if and only if any value $(D v) found in the
|
||||
|
@ -2688,7 +2688,7 @@ unittest
|
|||
unittest
|
||||
{
|
||||
import std.conv : text;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
debug(std_algorithm) scope(success)
|
||||
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
||||
|
@ -3171,7 +3171,7 @@ if (isInputRange!R &&
|
|||
import std.algorithm.iteration : filter;
|
||||
import std.conv : to;
|
||||
import std.range;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
debug(std_algorithm) scope(success)
|
||||
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
||||
|
|
|
@ -47,7 +47,7 @@ import std.range.primitives;
|
|||
import std.functional; // : unaryFun, binaryFun;
|
||||
import std.traits;
|
||||
// FIXME
|
||||
import std.typetuple; // : TypeTuple, staticMap, allSatisfy, anySatisfy;
|
||||
import std.meta; // : TypeTuple, staticMap, allSatisfy, anySatisfy;
|
||||
|
||||
// cartesianProduct
|
||||
/**
|
||||
|
|
|
@ -68,7 +68,7 @@ Source: $(PHOBOSSRC std/_array.d)
|
|||
module std.array;
|
||||
|
||||
import std.traits;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
import std.functional;
|
||||
static import std.algorithm; // FIXME, remove with alias of splitter
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ version (unittest)
|
|||
// FIXME: When dmd bug #314 is fixed, make these selective.
|
||||
import std.range; // : chain;
|
||||
import std.traits; // : functionAttributes, FunctionAttribute, isSafe;
|
||||
import std.typetuple; // : TypeTuple;
|
||||
import std.meta; // : TypeTuple;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1263,7 +1263,7 @@ unittest // 11148
|
|||
assert(__traits(compiles, foo(cbi)));
|
||||
assert(__traits(compiles, foo(ibi)));
|
||||
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
import std.conv : to;
|
||||
|
||||
foreach (T1; TypeTuple!(BigInt, const(BigInt), immutable(BigInt)))
|
||||
|
@ -1343,7 +1343,7 @@ unittest // 13391
|
|||
BigInt x2 = "123456789123456789";
|
||||
BigInt x3 = "123456789123456789123456789";
|
||||
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
foreach (T; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
|
||||
{
|
||||
assert((x1 * T.max) / T.max == x1);
|
||||
|
@ -1371,7 +1371,7 @@ unittest // 13391
|
|||
unittest // 13963
|
||||
{
|
||||
BigInt x = 1;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
foreach(Int; TypeTuple!(byte, ubyte, short, ushort, int, uint))
|
||||
{
|
||||
assert(is(typeof(x % Int(1)) == int));
|
||||
|
|
|
@ -2160,7 +2160,7 @@ private ulong swapEndianImpl(ulong val) @trusted pure nothrow @nogc
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(bool, byte, ubyte, short, ushort, int, uint, long, ulong, char, wchar, dchar))
|
||||
{
|
||||
scope(failure) writefln("Failed type: %s", T.stringof);
|
||||
|
@ -2276,7 +2276,7 @@ private auto nativeToBigEndianImpl(T)(T val) @safe pure nothrow @nogc
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(bool, byte, ubyte, short, ushort, int, uint, long, ulong,
|
||||
char, wchar, dchar
|
||||
/* The trouble here is with floats and doubles being compared against nan
|
||||
|
@ -2450,7 +2450,7 @@ private auto nativeToLittleEndianImpl(T)(T val) @safe pure nothrow @nogc
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(bool, byte, ubyte, short, ushort, int, uint, long, ulong,
|
||||
char, wchar, dchar/*,
|
||||
float, double*/))
|
||||
|
@ -2580,7 +2580,7 @@ private template isFloatOrDouble(T)
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(float, double))
|
||||
{
|
||||
static assert(isFloatOrDouble!(T));
|
||||
|
@ -2609,7 +2609,7 @@ private template canSwapEndianness(T)
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(bool, ubyte, byte, ushort, short, uint, int, ulong,
|
||||
long, char, wchar, dchar, float, double))
|
||||
{
|
||||
|
@ -3700,7 +3700,7 @@ unittest
|
|||
{
|
||||
import std.format : format;
|
||||
import std.array;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(endianness; TypeTuple!(Endian.bigEndian, Endian.littleEndian))
|
||||
{
|
||||
auto toWrite = appender!(ubyte[])();
|
||||
|
@ -3775,7 +3775,7 @@ unittest
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach (T; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
|
||||
{
|
||||
assert(countTrailingZeros(cast(T)0) == 8 * T.sizeof);
|
||||
|
@ -3856,7 +3856,7 @@ unittest
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach (T; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
|
||||
{
|
||||
assert(countBitsSet(cast(T)0) == 0);
|
||||
|
@ -3957,7 +3957,7 @@ unittest
|
|||
import std.algorithm : equal;
|
||||
import std.range: iota;
|
||||
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach (T; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
|
||||
{
|
||||
assert(bitsSet(cast(T)0).empty);
|
||||
|
|
|
@ -81,7 +81,7 @@ private
|
|||
import std.string;
|
||||
import std.traits;
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
template hasLocalAliasing(T...)
|
||||
{
|
||||
|
|
|
@ -424,7 +424,7 @@ public import std.container.dlist;
|
|||
public import std.container.rbtree;
|
||||
public import std.container.slist;
|
||||
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
|
||||
/* The following documentation and type $(D TotalContainer) are
|
||||
|
|
|
@ -635,7 +635,7 @@ final class RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false)
|
|||
{
|
||||
import std.range.primitives;
|
||||
import std.range : Take;
|
||||
import std.typetuple : allSatisfy;
|
||||
import std.meta : allSatisfy;
|
||||
import std.traits;
|
||||
|
||||
alias _less = binaryFun!less;
|
||||
|
|
|
@ -25,7 +25,7 @@ public import std.ascii : LetterCase;
|
|||
|
||||
import std.range.primitives;
|
||||
import std.traits;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
private string convFormat(Char, Args...)(in Char[] fmt, Args args)
|
||||
{
|
||||
|
|
|
@ -31077,7 +31077,7 @@ unittest
|
|||
import std.range;
|
||||
import std.string;
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
static struct Rand3Letters
|
||||
{
|
||||
|
@ -31346,7 +31346,7 @@ unittest
|
|||
import std.range;
|
||||
import std.string;
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
auto std1 = SysTime(DateTime(2012, 12, 21, 13, 14, 15), UTC());
|
||||
auto std2 = SysTime(DateTime(2012, 12, 21, 13, 14, 0), UTC());
|
||||
|
@ -31672,7 +31672,7 @@ unittest
|
|||
import std.format : format;
|
||||
import std.string;
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
static string genTest(size_t index)
|
||||
{
|
||||
|
@ -32800,7 +32800,7 @@ unittest
|
|||
import std.algorithm;
|
||||
import std.string;
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
foreach(cr; TypeTuple!(function(string a){return cast(ubyte[])a;},
|
||||
function(string a){return map!(b => cast(char)b)(a.representation);}))
|
||||
|
|
|
@ -62,7 +62,7 @@ $(TR $(TDNW Implementation helpers) $(TD $(MYREF digestLength) $(MYREF WrapperDi
|
|||
module std.digest.digest;
|
||||
|
||||
import std.traits;
|
||||
import std.typetuple : allSatisfy;
|
||||
import std.meta : allSatisfy;
|
||||
public import std.ascii : LetterCase;
|
||||
|
||||
|
||||
|
|
|
@ -2043,7 +2043,7 @@ unittest
|
|||
unittest
|
||||
{
|
||||
import std.range;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
{
|
||||
import std.conv : to;
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ unittest
|
|||
// purity and safety inference test
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
foreach (EncloseSafe; TypeTuple!(false, true))
|
||||
foreach (EnclosePure; TypeTuple!(false, true))
|
||||
|
|
|
@ -27,7 +27,7 @@ import std.path;
|
|||
import std.range.primitives;
|
||||
import std.traits;
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
import std.internal.cstring;
|
||||
|
||||
version (Windows)
|
||||
|
|
|
@ -64,7 +64,7 @@ import core.vararg;
|
|||
import std.exception;
|
||||
import std.range.primitives;
|
||||
import std.traits;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
version(CRuntime_DigitalMars)
|
||||
{
|
||||
|
|
|
@ -862,7 +862,7 @@ unittest
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple : staticMap;
|
||||
import std.meta : staticMap;
|
||||
import std.typecons : Tuple, tuple;
|
||||
alias funs = staticMap!(unaryFun, "a", "a * 2", "a * 3", "a * a", "-a");
|
||||
alias afun = adjoin!funs;
|
||||
|
@ -1410,7 +1410,7 @@ Forwards function arguments with saving ref-ness.
|
|||
*/
|
||||
template forward(args...)
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
static if (args.length)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ Used with the dummy ranges for testing higher order ranges.
|
|||
module std.internal.test.dummyrange;
|
||||
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
import std.range.primitives;
|
||||
|
||||
enum RangeType
|
||||
|
|
12
std/math.d
12
std/math.d
|
@ -539,7 +539,7 @@ auto abs(Num)(Num y) @safe pure nothrow @nogc
|
|||
|
||||
@safe pure nothrow @nogc unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach (T; TypeTuple!(float, double, real))
|
||||
{
|
||||
T f = 3;
|
||||
|
@ -2451,7 +2451,7 @@ unittest
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple, std.typecons;
|
||||
import std.meta, std.typecons;
|
||||
|
||||
foreach (T; TypeTuple!(real, double, float))
|
||||
{
|
||||
|
@ -2506,7 +2506,7 @@ unittest
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple: TypeTuple;
|
||||
import std.meta: TypeTuple;
|
||||
void foo() {
|
||||
foreach (T; TypeTuple!(real, double, float))
|
||||
{
|
||||
|
@ -4647,7 +4647,7 @@ bool isNaN(X)(X x) @nogc @trusted pure nothrow
|
|||
|
||||
@safe pure nothrow @nogc unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
foreach(T; TypeTuple!(float, double, real))
|
||||
{
|
||||
|
@ -4810,7 +4810,7 @@ int isSubnormal(X)(X x) @trusted pure nothrow @nogc
|
|||
///
|
||||
@safe pure nothrow @nogc unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
foreach (T; TypeTuple!(float, double, real))
|
||||
{
|
||||
|
@ -5043,7 +5043,7 @@ R copysign(R, X)(X to, R from) @trusted pure nothrow @nogc
|
|||
|
||||
@safe pure nothrow @nogc unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
foreach (X; TypeTuple!(float, double, real, int, long))
|
||||
{
|
||||
|
|
|
@ -171,7 +171,7 @@ import std.stream;
|
|||
import std.string;
|
||||
import std.traits;
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
import std.internal.cstring;
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ private template CustomFloatParams(uint bits)
|
|||
|
||||
private template CustomFloatParams(uint precision, uint exponentWidth, CustomFloatFlags flags)
|
||||
{
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
alias CustomFloatParams =
|
||||
TypeTuple!(
|
||||
precision,
|
||||
|
@ -175,7 +175,7 @@ struct CustomFloat(uint precision, // fraction bits (23 for float)
|
|||
precision + exponentWidth > 0)
|
||||
{
|
||||
import std.bitmanip;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
private:
|
||||
// get the correct unsigned bitfield type to support > 32 bits
|
||||
template uType(uint bits)
|
||||
|
@ -631,7 +631,7 @@ public:
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
alias FPTypes =
|
||||
TypeTuple!(
|
||||
CustomFloat!(5, 10),
|
||||
|
@ -1448,7 +1448,7 @@ euclideanDistance(Range1, Range2, F)(Range1 a, Range2 b, F limit)
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(double, const double, immutable double))
|
||||
{
|
||||
T[] a = [ 1.0, 2.0, ];
|
||||
|
@ -1538,7 +1538,7 @@ dotProduct(F1, F2)(in F1[] avector, in F2[] bvector)
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(double, const double, immutable double))
|
||||
{
|
||||
T[] a = [ 1.0, 2.0, ];
|
||||
|
@ -1582,7 +1582,7 @@ cosineSimilarity(Range1, Range2)(Range1 a, Range2 b)
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(double, const double, immutable double))
|
||||
{
|
||||
T[] a = [ 1.0, 2.0, ];
|
||||
|
@ -1732,7 +1732,7 @@ if (isInputRange!Range &&
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach(T; TypeTuple!(double, const double, immutable double))
|
||||
{
|
||||
T[] p = [ 0.0, 0, 0, 1 ];
|
||||
|
|
|
@ -89,7 +89,7 @@ import std.math;
|
|||
import std.range;
|
||||
import std.traits;
|
||||
import std.typecons;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
version(OSX)
|
||||
{
|
||||
|
|
|
@ -2691,7 +2691,7 @@ unittest
|
|||
else version (Posix) valid ~= pfdep;
|
||||
else static assert (0);
|
||||
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach (T; TypeTuple!(char[], const(char)[], string, wchar[],
|
||||
const(wchar)[], wstring, dchar[], const(dchar)[], dstring))
|
||||
{
|
||||
|
|
24
std/random.d
24
std/random.d
|
@ -66,8 +66,8 @@ import std.traits;
|
|||
|
||||
version(unittest)
|
||||
{
|
||||
static import std.typetuple;
|
||||
package alias PseudoRngTypes = std.typetuple.TypeTuple!(MinstdRand0, MinstdRand, Mt19937, Xorshift32, Xorshift64,
|
||||
static import std.meta;
|
||||
package alias PseudoRngTypes = TypeTuple!(MinstdRand0, MinstdRand, Mt19937, Xorshift32, Xorshift64,
|
||||
Xorshift96, Xorshift128, Xorshift160, Xorshift192);
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ unittest
|
|||
assert(rnd.front == 399268537);
|
||||
|
||||
// Check .save works
|
||||
foreach (Type; std.typetuple.TypeTuple!(MinstdRand0, MinstdRand))
|
||||
foreach (Type; TypeTuple!(MinstdRand0, MinstdRand))
|
||||
{
|
||||
auto rnd1 = Type(unpredictableSeed);
|
||||
auto rnd2 = rnd1.save;
|
||||
|
@ -788,7 +788,7 @@ unittest
|
|||
{
|
||||
import std.range;
|
||||
// Check .save works
|
||||
foreach(Type; std.typetuple.TypeTuple!(Mt19937))
|
||||
foreach(Type; TypeTuple!(Mt19937))
|
||||
{
|
||||
auto gen1 = Type(unpredictableSeed);
|
||||
auto gen2 = gen1.save;
|
||||
|
@ -806,7 +806,7 @@ unittest
|
|||
0x9d2c5680, 15,
|
||||
0xefc60000, 18);
|
||||
|
||||
foreach (R; std.typetuple.TypeTuple!(MT!(uint, 32), MT!(ulong, 32), MT!(ulong, 48), MT!(ulong, 64)))
|
||||
foreach (R; TypeTuple!(MT!(uint, 32), MT!(ulong, 32), MT!(ulong, 48), MT!(ulong, 64)))
|
||||
auto a = R();
|
||||
}
|
||||
|
||||
|
@ -1061,7 +1061,7 @@ unittest
|
|||
[0UL, 246875399, 3690007200, 1264581005, 3906711041, 1866187943, 2481925219, 2464530826, 1604040631, 3653403911]
|
||||
];
|
||||
|
||||
alias XorshiftTypes = std.typetuple.TypeTuple!(Xorshift32, Xorshift64, Xorshift96, Xorshift128, Xorshift160, Xorshift192);
|
||||
alias XorshiftTypes = TypeTuple!(Xorshift32, Xorshift64, Xorshift96, Xorshift128, Xorshift160, Xorshift192);
|
||||
|
||||
foreach (I, Type; XorshiftTypes)
|
||||
{
|
||||
|
@ -1436,7 +1436,7 @@ if ((isIntegral!(CommonType!(T1, T2)) || isSomeChar!(CommonType!(T1, T2))) &&
|
|||
auto c = uniform(0.0, 1.0);
|
||||
assert(0 <= c && c < 1);
|
||||
|
||||
foreach (T; std.typetuple.TypeTuple!(char, wchar, dchar, byte, ubyte, short, ushort,
|
||||
foreach (T; TypeTuple!(char, wchar, dchar, byte, ubyte, short, ushort,
|
||||
int, uint, long, ulong, float, double, real))
|
||||
{
|
||||
T lo = 0, hi = 100;
|
||||
|
@ -1490,7 +1490,7 @@ if ((isIntegral!(CommonType!(T1, T2)) || isSomeChar!(CommonType!(T1, T2))) &&
|
|||
|
||||
auto reproRng = Xorshift(239842);
|
||||
|
||||
foreach (T; std.typetuple.TypeTuple!(char, wchar, dchar, byte, ubyte, short,
|
||||
foreach (T; TypeTuple!(char, wchar, dchar, byte, ubyte, short,
|
||||
ushort, int, uint, long, ulong))
|
||||
{
|
||||
T lo = T.min + 10, hi = T.max - 10;
|
||||
|
@ -1609,7 +1609,7 @@ if (!is(T == enum) && (isIntegral!T || isSomeChar!T))
|
|||
|
||||
@safe unittest
|
||||
{
|
||||
foreach(T; std.typetuple.TypeTuple!(char, wchar, dchar, byte, ubyte, short, ushort,
|
||||
foreach(T; TypeTuple!(char, wchar, dchar, byte, ubyte, short, ushort,
|
||||
int, uint, long, ulong))
|
||||
{
|
||||
T init = uniform!T();
|
||||
|
@ -1756,11 +1756,11 @@ body
|
|||
|
||||
@safe unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach (UniformRNG; PseudoRngTypes)
|
||||
{
|
||||
|
||||
foreach (T; std.typetuple.TypeTuple!(float, double, real))
|
||||
foreach (T; TypeTuple!(float, double, real))
|
||||
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
|
||||
UniformRNG rng = UniformRNG(unpredictableSeed);
|
||||
|
||||
|
@ -2199,7 +2199,7 @@ unittest
|
|||
import std.algorithm;
|
||||
import std.conv;
|
||||
int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ];
|
||||
foreach (UniformRNG; std.typetuple.TypeTuple!(void, PseudoRngTypes))
|
||||
foreach (UniformRNG; TypeTuple!(void, PseudoRngTypes))
|
||||
{
|
||||
static if (is(UniformRNG == void))
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ module std.range.interfaces;
|
|||
|
||||
import std.range.primitives;
|
||||
import std.traits;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
/**These interfaces are intended to provide virtual function-based wrappers
|
||||
* around input ranges with element type E. This is useful where a well-defined
|
||||
|
|
|
@ -175,7 +175,7 @@ public import std.array;
|
|||
public import std.typecons : Flag, Yes, No;
|
||||
|
||||
import std.traits;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -853,7 +853,7 @@ if (Ranges.length > 0 &&
|
|||
}
|
||||
}
|
||||
|
||||
import std.typetuple : anySatisfy;
|
||||
import std.meta : anySatisfy;
|
||||
|
||||
static if (anySatisfy!(isInfinite, R))
|
||||
{
|
||||
|
|
|
@ -512,7 +512,7 @@ unittest
|
|||
{
|
||||
import std.conv : to;
|
||||
import std.typecons : tuple;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
static struct PutC(C)
|
||||
{
|
||||
|
@ -609,7 +609,7 @@ unittest
|
|||
unittest
|
||||
{
|
||||
import std.format;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
struct PutC(C)
|
||||
{
|
||||
void put(C){}
|
||||
|
@ -2055,7 +2055,7 @@ if (isNarrowString!(C[]))
|
|||
|
||||
@safe pure unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
foreach(S; TypeTuple!(string, wstring, dstring))
|
||||
{
|
||||
|
@ -2128,7 +2128,7 @@ if (isNarrowString!(T[]))
|
|||
|
||||
@safe pure unittest
|
||||
{
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
foreach(S; TypeTuple!(string, wstring, dstring))
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ module std.regex.internal.ir;
|
|||
|
||||
package(std.regex):
|
||||
|
||||
import std.exception, std.uni, std.typetuple, std.traits, std.range;
|
||||
import std.exception, std.uni, std.meta, std.traits, std.range;
|
||||
|
||||
// just a common trait, may be moved elsewhere
|
||||
alias BasicElementOf(Range) = Unqual!(ElementEncodingType!Range);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
module std.regex.internal.parser;
|
||||
|
||||
import std.regex.internal.ir;
|
||||
import std.algorithm, std.range, std.uni, std.typetuple,
|
||||
import std.algorithm, std.range, std.uni, std.meta,
|
||||
std.traits, std.typecons, std.exception;
|
||||
|
||||
// package relevant info from parser into a regex object
|
||||
|
|
|
@ -6,7 +6,7 @@ module std.regex.internal.tests;
|
|||
package(std.regex):
|
||||
|
||||
import std.algorithm, std.conv, std.exception, std.range, std.typecons,
|
||||
std.typetuple, std.regex;
|
||||
std.meta, std.regex;
|
||||
|
||||
import std.regex.internal.parser : Escapables; // characters that need escaping
|
||||
|
||||
|
|
|
@ -1353,7 +1353,7 @@ void main()
|
|||
{
|
||||
static import std.file;
|
||||
import std.algorithm : equal;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
auto deleteme = testFilename();
|
||||
std.file.write(deleteme, "hello\nworld\n");
|
||||
|
@ -1995,7 +1995,7 @@ the contents may well have changed).
|
|||
std.file.write(deleteme, "hi");
|
||||
scope(success) std.file.remove(deleteme);
|
||||
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
foreach (T; TypeTuple!(char, wchar, dchar))
|
||||
{
|
||||
auto blc = File(deleteme).byLine!(T, T);
|
||||
|
@ -3491,7 +3491,7 @@ if (isSomeChar!C && is(Unqual!C == C) && !is(C == enum) &&
|
|||
|
||||
unittest
|
||||
{
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
//we can't actually test readln, so at the very least,
|
||||
//we test compilability
|
||||
|
@ -3748,7 +3748,7 @@ struct lines
|
|||
unittest
|
||||
{
|
||||
static import std.file;
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
|
||||
//printf("Entering test at line %d\n", __LINE__);
|
||||
scope(failure) printf("Failed test at line %d\n", __LINE__);
|
||||
|
|
|
@ -162,7 +162,7 @@ import std.typecons : Flag;
|
|||
|
||||
import std.range.primitives;
|
||||
import std.traits;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
//public imports for backward compatibility
|
||||
public import std.algorithm : startsWith, endsWith, cmp, count;
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
*/
|
||||
module std.traits;
|
||||
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Functions
|
||||
|
|
144
std/typecons.d
144
std/typecons.d
|
@ -45,7 +45,7 @@ Authors: $(WEB erdani.org, Andrei Alexandrescu),
|
|||
module std.typecons;
|
||||
import std.traits;
|
||||
// FIXME
|
||||
import std.typetuple; // : TypeTuple, allSatisfy;
|
||||
import std.meta; // : TypeTuple, allSatisfy;
|
||||
|
||||
debug(Unique) import std.stdio;
|
||||
|
||||
|
@ -418,7 +418,7 @@ Params:
|
|||
*/
|
||||
template Tuple(Specs...)
|
||||
{
|
||||
import std.typetuple : staticMap;
|
||||
import std.meta : staticMap;
|
||||
|
||||
// Parse (type,name) pairs (FieldSpecs) out of the specified
|
||||
// arguments. Some fields would have name, others not.
|
||||
|
@ -542,7 +542,7 @@ template Tuple(Specs...)
|
|||
* The types of the `Tuple`'s components.
|
||||
*/
|
||||
alias Types = staticMap!(extractType, fieldSpecs);
|
||||
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
|
@ -554,7 +554,7 @@ template Tuple(Specs...)
|
|||
* The names of the `Tuple`'s components. Unnamed fields have empty names.
|
||||
*/
|
||||
alias fieldNames = staticMap!(extractName, fieldSpecs);
|
||||
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
|
@ -570,18 +570,18 @@ template Tuple(Specs...)
|
|||
*/
|
||||
Types expand;
|
||||
mixin(injectNamedFields());
|
||||
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
auto t1 = tuple(1, " hello ", 2.3);
|
||||
assert(t1.toString() == `Tuple!(int, string, double)(1, " hello ", 2.3)`);
|
||||
|
||||
void takeSeveralTypes(int n, string s, bool b)
|
||||
|
||||
void takeSeveralTypes(int n, string s, bool b)
|
||||
{
|
||||
assert(n == 4 && s == "test" && b == false);
|
||||
}
|
||||
|
||||
|
||||
auto t2 = tuple(4, "test", false);
|
||||
//t.expand acting as a list of values
|
||||
takeSeveralTypes(t2.expand);
|
||||
|
@ -617,8 +617,8 @@ template Tuple(Specs...)
|
|||
* Params:
|
||||
* values = A list of values that are either the same
|
||||
* types as those given by the `Types` field
|
||||
* of this `Tuple`, or can implicitly convert
|
||||
* to those types. They must be in the same
|
||||
* of this `Tuple`, or can implicitly convert
|
||||
* to those types. They must be in the same
|
||||
* order as they appear in `Types`.
|
||||
*/
|
||||
static if (Types.length > 0)
|
||||
|
@ -628,7 +628,7 @@ template Tuple(Specs...)
|
|||
field[] = values[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
|
@ -652,7 +652,7 @@ template Tuple(Specs...)
|
|||
field[i] = values[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
|
@ -675,15 +675,15 @@ template Tuple(Specs...)
|
|||
{
|
||||
field[] = another.field[];
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
alias IntVec = Tuple!(int, int, int);
|
||||
alias DubVec = Tuple!(double, double, double);
|
||||
|
||||
|
||||
IntVec iv = tuple(1, 1, 1);
|
||||
|
||||
|
||||
//Ok, int can implicitly convert to double
|
||||
DubVec dv = iv;
|
||||
//Error: double cannot implicitly convert to int
|
||||
|
@ -694,13 +694,13 @@ template Tuple(Specs...)
|
|||
* Comparison for equality. Two `Tuple`s are considered equal
|
||||
* $(B iff) they fulfill the following criteria:
|
||||
*
|
||||
* $(UL
|
||||
* $(UL
|
||||
* $(LI Each `Tuple` is the same length.)
|
||||
* $(LI For each type `T` on the left-hand side and each type
|
||||
* `U` on the right-hand side, values of type `T` can be
|
||||
* $(LI For each type `T` on the left-hand side and each type
|
||||
* `U` on the right-hand side, values of type `T` can be
|
||||
* compared with values of type `U`.)
|
||||
* $(LI For each value `v1` on the left-hand side and each value
|
||||
* `v2` on the right-hand side, the expression `v1 == v2` is
|
||||
* $(LI For each value `v1` on the left-hand side and each value
|
||||
* `v2` on the right-hand side, the expression `v1 == v2` is
|
||||
* true.))
|
||||
*
|
||||
* Params:
|
||||
|
@ -715,14 +715,14 @@ template Tuple(Specs...)
|
|||
{
|
||||
return field[] == rhs.field[];
|
||||
}
|
||||
|
||||
|
||||
/// ditto
|
||||
bool opEquals(R)(R rhs) const
|
||||
if (areCompatibleTuples!(typeof(this), R, "=="))
|
||||
{
|
||||
return field[] == rhs.field[];
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
|
@ -761,7 +761,7 @@ template Tuple(Specs...)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// ditto
|
||||
int opCmp(R)(R rhs) const
|
||||
if (areCompatibleTuples!(typeof(this), R, "<"))
|
||||
|
@ -775,8 +775,8 @@ template Tuple(Specs...)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
The first `v1` for which `v1 > v2` is true determines
|
||||
the result. This could lead to unexpected behaviour.
|
||||
*/
|
||||
|
@ -785,7 +785,7 @@ template Tuple(Specs...)
|
|||
auto tup1 = tuple(1, 1, 1);
|
||||
auto tup2 = tuple(1, 100, 100);
|
||||
assert(tup1 < tup2);
|
||||
|
||||
|
||||
//Only the first result matters for comparison
|
||||
tup1[0] = 2;
|
||||
assert(tup1 > tup2);
|
||||
|
@ -795,7 +795,7 @@ template Tuple(Specs...)
|
|||
* Assignment from another `Tuple`.
|
||||
*
|
||||
* Params:
|
||||
* rhs = The source `Tuple` to assign from. Each element of the
|
||||
* rhs = The source `Tuple` to assign from. Each element of the
|
||||
* source `Tuple` must be implicitly assignable to each
|
||||
* respective element of the target `Tuple`.
|
||||
*/
|
||||
|
@ -832,8 +832,8 @@ template Tuple(Specs...)
|
|||
* to = A `size_t` designating the ending position (exclusive) of the slice.
|
||||
*
|
||||
* Returns:
|
||||
* A new `Tuple` that is a slice from `[from, to$(RPAREN)` of the original.
|
||||
* It has the same types and values as the range `[from, to$(RPAREN)` in
|
||||
* A new `Tuple` that is a slice from `[from, to$(RPAREN)` of the original.
|
||||
* It has the same types and values as the range `[from, to$(RPAREN)` in
|
||||
* the original.
|
||||
*/
|
||||
@property
|
||||
|
@ -842,7 +842,7 @@ template Tuple(Specs...)
|
|||
{
|
||||
return *cast(typeof(return)*) &(field[from]);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
unittest
|
||||
{
|
||||
|
@ -856,7 +856,7 @@ template Tuple(Specs...)
|
|||
|
||||
/**
|
||||
Creates a hash of this `Tuple`.
|
||||
|
||||
|
||||
Returns:
|
||||
A `size_t` representing the hash of this `Tuple`.
|
||||
*/
|
||||
|
@ -867,7 +867,7 @@ template Tuple(Specs...)
|
|||
h += typeid(T).getHash(cast(const void*)&field[i]);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
void toString(DG)(scope DG sink)
|
||||
{
|
||||
enum header = typeof(this).stringof ~ "(",
|
||||
|
@ -921,7 +921,7 @@ unittest
|
|||
auto y = point[1];
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
`Tuple` members can be named. It is legal to mix named and unnamed
|
||||
members. The method above is still applicable to all fields.
|
||||
*/
|
||||
|
@ -950,17 +950,17 @@ unittest
|
|||
|
||||
/**
|
||||
Create a copy of a `Tuple` with its fields in reverse order.
|
||||
|
||||
|
||||
Params:
|
||||
t = The `Tuple` to copy.
|
||||
|
||||
|
||||
Returns:
|
||||
A copy of `t` with its fields in reverse order.
|
||||
*/
|
||||
ReverseTupleType!T reverse(T)(T t)
|
||||
if (isTuple!T)
|
||||
{
|
||||
import std.typetuple : Reverse;
|
||||
import std.meta : Reverse;
|
||||
// @@@BUG@@@ Cannot be an internal function due to forward reference issues.
|
||||
|
||||
// @@@BUG@@@ 9929 Need 'this' when calling template with expanded tuple
|
||||
|
@ -1389,17 +1389,17 @@ unittest
|
|||
/**
|
||||
Constructs a $(D Tuple) object instantiated and initialized according to
|
||||
the given arguments.
|
||||
|
||||
|
||||
Params:
|
||||
Names = A list of strings naming each successive field of the `Tuple`.
|
||||
Each name matches up with the corresponding field given by `Args`.
|
||||
A name does not have to be provided for every field, but as
|
||||
the names must proceed in order, it is not possible to skip
|
||||
one field and name the next after it.
|
||||
|
||||
|
||||
args = Values to initialize the `Tuple` with. The `Tuple`'s type will
|
||||
be inferred from the types of the values given.
|
||||
|
||||
|
||||
Returns:
|
||||
A new `Tuple` with its type inferred from the arguments given.
|
||||
*/
|
||||
|
@ -1460,10 +1460,10 @@ unittest
|
|||
|
||||
/**
|
||||
Returns $(D true) if and only if $(D T) is an instance of $(D std.typecons.Tuple).
|
||||
|
||||
|
||||
Params:
|
||||
T = The type to check.
|
||||
|
||||
|
||||
Returns:
|
||||
true if `T` is a `Tuple` type, false otherwise.
|
||||
*/
|
||||
|
@ -1599,7 +1599,7 @@ unittest
|
|||
}
|
||||
|
||||
/**
|
||||
However, $(D Rebindable!(Widget)) does allow reassignment,
|
||||
However, $(D Rebindable!(Widget)) does allow reassignment,
|
||||
while otherwise behaving exactly like a $(D const Widget).
|
||||
*/
|
||||
unittest
|
||||
|
@ -1621,7 +1621,7 @@ inference.
|
|||
Params:
|
||||
obj = A reference to an object or interface, or an array slice
|
||||
to initialize the `Rebindable` with.
|
||||
|
||||
|
||||
Returns:
|
||||
A newly constructed `Rebindable` initialized with the given reference.
|
||||
*/
|
||||
|
@ -1736,7 +1736,7 @@ unittest
|
|||
Similar to $(D Rebindable!(T)) but strips all qualifiers from the reference as
|
||||
opposed to just constness / immutability. Primary intended use case is with
|
||||
shared (having thread-local reference to shared class data)
|
||||
|
||||
|
||||
Params:
|
||||
T = A class or interface type.
|
||||
*/
|
||||
|
@ -1794,13 +1794,13 @@ unittest
|
|||
Order the provided members to minimize size while preserving alignment.
|
||||
Alignment is not always optimal for 80-bit reals, nor for structs declared
|
||||
as align(1).
|
||||
|
||||
|
||||
Params:
|
||||
E = A list of the types to be aligned, representing fields
|
||||
E = A list of the types to be aligned, representing fields
|
||||
of an aggregate such as a `struct` or `class`.
|
||||
|
||||
|
||||
names = The names of the fields that are to be aligned.
|
||||
|
||||
|
||||
Returns:
|
||||
A string to be mixed in to an aggregate, such as a `struct` or `class`.
|
||||
*/
|
||||
|
@ -3200,7 +3200,7 @@ private static:
|
|||
{
|
||||
template Impl(names...)
|
||||
{
|
||||
import std.typetuple : Filter;
|
||||
import std.meta : Filter;
|
||||
static if (names.length > 0)
|
||||
{
|
||||
alias methods = Filter!(pred, MemberFunctionsTuple!(C, names[0]));
|
||||
|
@ -3884,7 +3884,7 @@ unittest
|
|||
template wrap(Targets...)
|
||||
if (Targets.length >= 1 && allSatisfy!(isMutable, Targets))
|
||||
{
|
||||
import std.typetuple : staticMap;
|
||||
import std.meta : staticMap;
|
||||
|
||||
// strict upcast
|
||||
auto wrap(Source)(inout Source src) @trusted pure nothrow
|
||||
|
@ -4057,7 +4057,7 @@ if (Targets.length >= 1 && allSatisfy!(isMutable, Targets))
|
|||
template wrap(Targets...)
|
||||
if (Targets.length >= 1 && !allSatisfy!(isMutable, Targets))
|
||||
{
|
||||
import std.typetuple : staticMap;
|
||||
import std.meta : staticMap;
|
||||
|
||||
alias wrap = .wrap!(staticMap!(Unqual, Targets));
|
||||
}
|
||||
|
@ -4291,7 +4291,7 @@ unittest
|
|||
// Make a tuple of non-static function symbols
|
||||
private template GetOverloadedMethods(T)
|
||||
{
|
||||
import std.typetuple : Filter;
|
||||
import std.meta : Filter;
|
||||
|
||||
alias allMembers = TypeTuple!(__traits(allMembers, T));
|
||||
template follows(size_t i = 0)
|
||||
|
@ -4316,7 +4316,7 @@ private template GetOverloadedMethods(T)
|
|||
enum isMethod = false;
|
||||
}
|
||||
alias follows = TypeTuple!(
|
||||
std.typetuple.Filter!(isMethod, __traits(getOverloads, T, name)),
|
||||
Filter!(isMethod, __traits(getOverloads, T, name)),
|
||||
follows!(i + 1));
|
||||
}
|
||||
}
|
||||
|
@ -5001,15 +5001,15 @@ unittest
|
|||
|
||||
/**
|
||||
Creates a proxy for the value `a` that will forward all operations
|
||||
while disabling implicit conversions. The aliased item `a` must be
|
||||
an $(B lvalue). This is useful for creating a new type from the
|
||||
"base" type (though this is $(B not) a subtype-supertype
|
||||
relationship; the new type is not related to the old type in any way,
|
||||
while disabling implicit conversions. The aliased item `a` must be
|
||||
an $(B lvalue). This is useful for creating a new type from the
|
||||
"base" type (though this is $(B not) a subtype-supertype
|
||||
relationship; the new type is not related to the old type in any way,
|
||||
by design).
|
||||
|
||||
|
||||
The new type supports all operations that the underlying type does,
|
||||
including all operators such as `+`, `--`, `<`, `[]`, etc.
|
||||
|
||||
|
||||
Params:
|
||||
a = The value to act as a proxy for all operations. It must
|
||||
be an lvalue.
|
||||
|
@ -5248,29 +5248,29 @@ unittest
|
|||
{
|
||||
//Won't work; the literal '1' is
|
||||
//is an rvalue, not an lvalue
|
||||
//mixin Proxy!1;
|
||||
|
||||
//mixin Proxy!1;
|
||||
|
||||
//Okay, n is an lvalue
|
||||
int n;
|
||||
mixin Proxy!n;
|
||||
|
||||
|
||||
this(int n) { this.n = n; }
|
||||
}
|
||||
|
||||
|
||||
NewIntType nit = 0;
|
||||
nit++;
|
||||
assert(nit == 1);
|
||||
|
||||
|
||||
|
||||
|
||||
struct NewObjectType
|
||||
{
|
||||
Object obj;
|
||||
//Ok, obj is an lvalue
|
||||
mixin Proxy!obj;
|
||||
|
||||
|
||||
this (Object o) { obj = o; }
|
||||
}
|
||||
|
||||
|
||||
NewObjectType not = new Object();
|
||||
assert(__traits(compiles, not.toHash()));
|
||||
}
|
||||
|
@ -5278,24 +5278,24 @@ unittest
|
|||
/**
|
||||
There is one exception to the fact that the new type is not related to the
|
||||
old type. $(LINK2 http://dlang.org/function.html#pseudo-member, Pseudo-member)
|
||||
functions are usable with the new type; they will be forwarded on to the
|
||||
functions are usable with the new type; they will be forwarded on to the
|
||||
proxied value.
|
||||
*/
|
||||
unittest
|
||||
{
|
||||
import std.math;
|
||||
|
||||
|
||||
float f = 1.0;
|
||||
assert(!f.isInfinity);
|
||||
|
||||
|
||||
struct NewFloat
|
||||
{
|
||||
float _;
|
||||
mixin Proxy!_;
|
||||
|
||||
|
||||
this(float f) { _ = f; }
|
||||
}
|
||||
|
||||
|
||||
NewFloat nf = 1.0f;
|
||||
assert(!nf.isInfinity);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
deprecated("Please use std.typetuple instead. This module will be removed in March 2015.")
|
||||
module std.typelist;
|
||||
version(unittest) {
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -649,7 +649,7 @@ CLUSTER = $(S_LINK Grapheme cluster, grapheme cluster)
|
|||
module std.uni;
|
||||
|
||||
import core.stdc.stdlib;
|
||||
import std.traits, std.typetuple;
|
||||
import std.traits, std.meta;
|
||||
import std.range.primitives;
|
||||
|
||||
|
||||
|
|
|
@ -545,7 +545,7 @@ unittest
|
|||
result = decode("%41%42%43");
|
||||
debug(uri) writeln(result);
|
||||
|
||||
import std.typetuple : TypeTuple;
|
||||
import std.meta : TypeTuple;
|
||||
foreach (StringType; TypeTuple!(char[], wchar[], dchar[], string, wstring, dstring))
|
||||
{
|
||||
import std.conv : to;
|
||||
|
|
|
@ -22,7 +22,7 @@ module std.utf;
|
|||
|
||||
import std.range.primitives;
|
||||
import std.traits; // isSomeChar, isSomeString
|
||||
import std.typetuple; // TypeTuple
|
||||
import std.meta; // TypeTuple
|
||||
|
||||
//debug=utf; // uncomment to turn on debugging printf's
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ import std.traits;
|
|||
*/
|
||||
public struct UUID
|
||||
{
|
||||
import std.typetuple : allSatisfy;
|
||||
import std.meta : allSatisfy;
|
||||
import std.traits : isIntegral;
|
||||
|
||||
private:
|
||||
|
@ -418,7 +418,7 @@ public struct UUID
|
|||
@safe pure unittest
|
||||
{
|
||||
import std.exception;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
import std.conv : to;
|
||||
|
||||
foreach(S; TypeTuple!(char[], const(char)[], immutable(char)[],
|
||||
|
@ -1355,7 +1355,7 @@ unittest
|
|||
@safe pure unittest
|
||||
{
|
||||
import std.exception;
|
||||
import std.typetuple;
|
||||
import std.meta;
|
||||
import std.conv : to;
|
||||
|
||||
struct TestRange(bool forward)
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
module std.variant;
|
||||
|
||||
import core.stdc.string, std.conv, std.exception, std.traits, std.typecons,
|
||||
std.typetuple;
|
||||
std.meta;
|
||||
|
||||
/++
|
||||
Gives the $(D sizeof) the largest type given.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue