Remove functions deprecated in 0.9.0
This commit is contained in:
parent
f51e9405c9
commit
411e45ec5c
@ -20,26 +20,3 @@ public import tanya.container.hashtable;
|
|||||||
public import tanya.container.list;
|
public import tanya.container.list;
|
||||||
public import tanya.container.set;
|
public import tanya.container.set;
|
||||||
public import tanya.container.string;
|
public import tanya.container.string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Thrown if $(D_PSYMBOL Set) cannot insert a new element because the container
|
|
||||||
* is full.
|
|
||||||
*/
|
|
||||||
deprecated
|
|
||||||
class HashContainerFullException : Exception
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Params:
|
|
||||||
* msg = The message for the exception.
|
|
||||||
* file = The file where the exception occurred.
|
|
||||||
* line = The line number where the exception occurred.
|
|
||||||
* next = The previous exception in the chain of exceptions, if any.
|
|
||||||
*/
|
|
||||||
this(string msg,
|
|
||||||
string file = __FILE__,
|
|
||||||
size_t line = __LINE__,
|
|
||||||
Throwable next = null) @nogc nothrow pure @safe
|
|
||||||
{
|
|
||||||
super(msg, file, line, next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -739,101 +739,3 @@ bool isPseudoprime(ulong x) @nogc nothrow pure @safe
|
|||||||
assert(899809363.isPseudoprime);
|
assert(899809363.isPseudoprime);
|
||||||
assert(982451653.isPseudoprime);
|
assert(982451653.isPseudoprime);
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated("Use tanya.algorithm.comparison.min instead")
|
|
||||||
T min(T)(T x, T y)
|
|
||||||
if (isIntegral!T)
|
|
||||||
{
|
|
||||||
return x < y ? x : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated("Use tanya.algorithm.comparison.min instead")
|
|
||||||
T min(T)(T x, T y)
|
|
||||||
if (isFloatingPoint!T)
|
|
||||||
{
|
|
||||||
if (isNaN(x))
|
|
||||||
{
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
if (isNaN(y))
|
|
||||||
{
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
return x < y ? x : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated("Use tanya.algorithm.comparison.min instead")
|
|
||||||
ref T min(T)(ref T x, ref T y)
|
|
||||||
if (is(Unqual!T == Integer))
|
|
||||||
{
|
|
||||||
return x < y ? x : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated("Use tanya.algorithm.comparison.min instead")
|
|
||||||
T min(T)(T x, T y)
|
|
||||||
if (is(T == Integer))
|
|
||||||
{
|
|
||||||
return x < y ? move(x) : move(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
@nogc nothrow pure @safe unittest
|
|
||||||
{
|
|
||||||
assert(min(Integer(5), Integer(3)) == 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated("Use tanya.algorithm.comparison.max instead")
|
|
||||||
T max(T)(T x, T y)
|
|
||||||
if (isIntegral!T)
|
|
||||||
{
|
|
||||||
return x > y ? x : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated("Use tanya.algorithm.comparison.max instead")
|
|
||||||
T max(T)(T x, T y)
|
|
||||||
if (isFloatingPoint!T)
|
|
||||||
{
|
|
||||||
if (isNaN(x))
|
|
||||||
{
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
if (isNaN(y))
|
|
||||||
{
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
return x > y ? x : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated("Use tanya.algorithm.comparison.max instead")
|
|
||||||
ref T max(T)(ref T x, ref T y)
|
|
||||||
if (is(Unqual!T == Integer))
|
|
||||||
{
|
|
||||||
return x > y ? x : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated("Use tanya.algorithm.comparison.max instead")
|
|
||||||
T max(T)(T x, T y)
|
|
||||||
if (is(T == Integer))
|
|
||||||
{
|
|
||||||
return x > y ? move(x) : move(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
@nogc nothrow pure @safe unittest
|
|
||||||
{
|
|
||||||
assert(max(Integer(5), Integer(3)) == 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
// min/max accept const and mutable references.
|
|
||||||
@nogc nothrow pure @safe unittest
|
|
||||||
{
|
|
||||||
{
|
|
||||||
Integer i1 = 5, i2 = 3;
|
|
||||||
assert(min(i1, i2) == 3);
|
|
||||||
assert(max(i1, i2) == 5);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
const Integer i1 = 5, i2 = 3;
|
|
||||||
assert(min(i1, i2) == 3);
|
|
||||||
assert(max(i1, i2) == 5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -70,26 +70,6 @@ enum bool isWideString(T) = is(T : const dchar[]) && !isStaticArray!T;
|
|||||||
static assert(!isWideString!(dchar[10]));
|
static assert(!isWideString!(dchar[10]));
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated("Use tanya.meta.transform.Smallest instead")
|
|
||||||
template Smallest(Args...)
|
|
||||||
if (Args.length >= 1)
|
|
||||||
{
|
|
||||||
static assert(is(Args[0]), T.stringof ~ " doesn't have .sizeof property");
|
|
||||||
|
|
||||||
static if (Args.length == 1)
|
|
||||||
{
|
|
||||||
alias Smallest = Args[0];
|
|
||||||
}
|
|
||||||
else static if (Smallest!(Args[1 .. $]).sizeof < Args[0].sizeof)
|
|
||||||
{
|
|
||||||
alias Smallest = Smallest!(Args[1 .. $]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alias Smallest = Args[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether $(D_PARAM T) is a complex type.
|
* Determines whether $(D_PARAM T) is a complex type.
|
||||||
*
|
*
|
||||||
@ -178,7 +158,7 @@ enum bool isPolymorphicType(T) = is(T == class) || is(T == interface);
|
|||||||
*/
|
*/
|
||||||
template hasStaticMember(T, string member)
|
template hasStaticMember(T, string member)
|
||||||
{
|
{
|
||||||
static if (__traits(hasMember, T, member))
|
static if (hasMember!(T, member))
|
||||||
{
|
{
|
||||||
alias Member = Alias!(__traits(getMember, T, member));
|
alias Member = Alias!(__traits(getMember, T, member));
|
||||||
|
|
||||||
@ -928,26 +908,6 @@ template mostNegative(T)
|
|||||||
static assert(mostNegative!cfloat == -cfloat.max);
|
static assert(mostNegative!cfloat == -cfloat.max);
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated("Use tanya.meta.transform.Largest instead")
|
|
||||||
template Largest(Args...)
|
|
||||||
if (Args.length >= 1)
|
|
||||||
{
|
|
||||||
static assert(is(Args[0]), T.stringof ~ " doesn't have .sizeof property");
|
|
||||||
|
|
||||||
static if (Args.length == 1)
|
|
||||||
{
|
|
||||||
alias Largest = Args[0];
|
|
||||||
}
|
|
||||||
else static if (Largest!(Args[1 .. $]).sizeof > Args[0].sizeof)
|
|
||||||
{
|
|
||||||
alias Largest = Largest!(Args[1 .. $]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alias Largest = Args[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the type $(D_PARAM T) is copyable.
|
* Determines whether the type $(D_PARAM T) is copyable.
|
||||||
*
|
*
|
||||||
@ -1540,7 +1500,6 @@ if (F.length == 1)
|
|||||||
* Returns: $(D_KEYWORD true) if $(D_PARAM T) defines a symbol
|
* Returns: $(D_KEYWORD true) if $(D_PARAM T) defines a symbol
|
||||||
* $(D_PARAM member), $(D_KEYWORD false) otherwise.
|
* $(D_PARAM member), $(D_KEYWORD false) otherwise.
|
||||||
*/
|
*/
|
||||||
deprecated("Use __traits(hasMember) instead")
|
|
||||||
enum bool hasMember(T, string member) = __traits(hasMember, T, member);
|
enum bool hasMember(T, string member) = __traits(hasMember, T, member);
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -112,17 +112,10 @@ else version (Windows)
|
|||||||
socket,
|
socket,
|
||||||
socklen_t,
|
socklen_t,
|
||||||
SOL_SOCKET,
|
SOL_SOCKET,
|
||||||
|
WSAEWOULDBLOCK,
|
||||||
WSAGetLastError;
|
WSAGetLastError;
|
||||||
import tanya.async.iocp;
|
import tanya.async.iocp;
|
||||||
import tanya.sys.windows.def;
|
import tanya.sys.windows.def;
|
||||||
import tanya.sys.windows.error : ECONNABORTED = WSAECONNABORTED,
|
|
||||||
ENOBUFS = WSAENOBUFS,
|
|
||||||
EOPNOTSUPP = WSAEOPNOTSUPP,
|
|
||||||
EPROTONOSUPPORT = WSAEPROTONOSUPPORT,
|
|
||||||
EPROTOTYPE = WSAEPROTOTYPE,
|
|
||||||
ESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT,
|
|
||||||
ETIMEDOUT = WSAETIMEDOUT,
|
|
||||||
EWOULDBLOCK = WSAEWOULDBLOCK;
|
|
||||||
public import tanya.sys.windows.winbase;
|
public import tanya.sys.windows.winbase;
|
||||||
public import tanya.sys.windows.winsock2;
|
public import tanya.sys.windows.winsock2;
|
||||||
|
|
||||||
@ -616,37 +609,6 @@ enum AddressFamily : int
|
|||||||
inet6 = 10, /// IP version 6.
|
inet6 = 10, /// IP version 6.
|
||||||
}
|
}
|
||||||
|
|
||||||
deprecated("Use tanya.os.error.ErrorCode.ErrorNo instead")
|
|
||||||
enum SocketError : int
|
|
||||||
{
|
|
||||||
/// Unknown error.
|
|
||||||
unknown = 0,
|
|
||||||
/// Firewall rules forbid connection.
|
|
||||||
accessDenied = EPERM,
|
|
||||||
/// A socket operation was attempted on a non-socket.
|
|
||||||
notSocket = EBADF,
|
|
||||||
/// The network is not available.
|
|
||||||
networkDown = ECONNABORTED,
|
|
||||||
/// An invalid pointer address was detected by the underlying socket provider.
|
|
||||||
fault = EFAULT,
|
|
||||||
/// An invalid argument was supplied to a $(D_PSYMBOL Socket) member.
|
|
||||||
invalidArgument = EINVAL,
|
|
||||||
/// The limit on the number of open sockets has been reached.
|
|
||||||
tooManyOpenSockets = ENFILE,
|
|
||||||
/// No free buffer space is available for a Socket operation.
|
|
||||||
noBufferSpaceAvailable = ENOBUFS,
|
|
||||||
/// The address family is not supported by the protocol family.
|
|
||||||
operationNotSupported = EOPNOTSUPP,
|
|
||||||
/// The protocol is not implemented or has not been configured.
|
|
||||||
protocolNotSupported = EPROTONOSUPPORT,
|
|
||||||
/// Protocol error.
|
|
||||||
protocolError = EPROTOTYPE,
|
|
||||||
/// The connection attempt timed out, or the connected host has failed to respond.
|
|
||||||
timedOut = ETIMEDOUT,
|
|
||||||
/// The support for the specified socket type does not exist in this address family.
|
|
||||||
socketNotSupported = ESOCKTNOSUPPORT,
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $(D_PSYMBOL SocketException) should be thrown only if one of the socket functions
|
* $(D_PSYMBOL SocketException) should be thrown only if one of the socket functions
|
||||||
* $(D_PSYMBOL socketError) and sets $(D_PSYMBOL errno), because
|
* $(D_PSYMBOL socketError) and sets $(D_PSYMBOL errno), because
|
||||||
@ -1476,7 +1438,7 @@ bool wouldHaveBlocked() nothrow @trusted @nogc
|
|||||||
else version (Windows)
|
else version (Windows)
|
||||||
{
|
{
|
||||||
return WSAGetLastError() == ERROR_IO_PENDING
|
return WSAGetLastError() == ERROR_IO_PENDING
|
||||||
|| WSAGetLastError() == EWOULDBLOCK
|
|| WSAGetLastError() == WSAEWOULDBLOCK
|
||||||
|| WSAGetLastError() == ERROR_IO_INCOMPLETE;
|
|| WSAGetLastError() == ERROR_IO_INCOMPLETE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
*/
|
*/
|
||||||
module tanya.range.primitive;
|
module tanya.range.primitive;
|
||||||
|
|
||||||
|
import tanya.algorithm.comparison;
|
||||||
import tanya.algorithm.mutation;
|
import tanya.algorithm.mutation;
|
||||||
import tanya.math;
|
|
||||||
import tanya.meta.trait;
|
import tanya.meta.trait;
|
||||||
import tanya.meta.transform;
|
import tanya.meta.transform;
|
||||||
import tanya.range.array;
|
import tanya.range.array;
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copyright: Eugene Wissner 2017-2018.
|
|
||||||
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
|
|
||||||
* Mozilla Public License, v. 2.0).
|
|
||||||
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
|
|
||||||
* Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/sys/windows/error.d,
|
|
||||||
* tanya/sys/windows/error.d)
|
|
||||||
*/
|
|
||||||
deprecated("Use core.sys.windows.winerror instead")
|
|
||||||
module tanya.sys.windows.error;
|
|
||||||
|
|
||||||
version (Windows):
|
|
||||||
|
|
||||||
private enum WSABASEERR = 10000;
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
WSAEINTR = WSABASEERR + 4,
|
|
||||||
WSAEBADF = WSABASEERR + 9,
|
|
||||||
WSAEACCES = WSABASEERR + 13,
|
|
||||||
WSAEFAULT = WSABASEERR + 14,
|
|
||||||
WSAEINVAL = WSABASEERR + 22,
|
|
||||||
WSAEMFILE = WSABASEERR + 24,
|
|
||||||
|
|
||||||
WSAEWOULDBLOCK = WSABASEERR + 35,
|
|
||||||
WSAEINPROGRESS = WSABASEERR + 36,
|
|
||||||
WSAEALREADY = WSABASEERR + 37,
|
|
||||||
WSAENOTSOCK = WSABASEERR + 38,
|
|
||||||
WSAEDESTADDRREQ = WSABASEERR + 39,
|
|
||||||
WSAEMSGSIZE = WSABASEERR + 40,
|
|
||||||
WSAEPROTOTYPE = WSABASEERR + 41,
|
|
||||||
WSAENOPROTOOPT = WSABASEERR + 42,
|
|
||||||
WSAEPROTONOSUPPORT = WSABASEERR + 43,
|
|
||||||
WSAESOCKTNOSUPPORT = WSABASEERR + 44,
|
|
||||||
WSAEOPNOTSUPP = WSABASEERR + 45,
|
|
||||||
WSAEPFNOSUPPORT = WSABASEERR + 46,
|
|
||||||
WSAEAFNOSUPPORT = WSABASEERR + 47,
|
|
||||||
WSAEADDRINUSE = WSABASEERR + 48,
|
|
||||||
WSAEADDRNOTAVAIL = WSABASEERR + 49,
|
|
||||||
WSAENETDOWN = WSABASEERR + 50,
|
|
||||||
WSAENETUNREACH = WSABASEERR + 51,
|
|
||||||
WSAENETRESET = WSABASEERR + 52,
|
|
||||||
WSAECONNABORTED = WSABASEERR + 53,
|
|
||||||
WSAECONNRESET = WSABASEERR + 54,
|
|
||||||
WSAENOBUFS = WSABASEERR + 55,
|
|
||||||
WSAEISCONN = WSABASEERR + 56,
|
|
||||||
WSAENOTCONN = WSABASEERR + 57,
|
|
||||||
WSAESHUTDOWN = WSABASEERR + 58,
|
|
||||||
WSAETOOMANYREFS = WSABASEERR + 59,
|
|
||||||
WSAETIMEDOUT = WSABASEERR + 60,
|
|
||||||
WSAECONNREFUSED = WSABASEERR + 61,
|
|
||||||
WSAELOOP = WSABASEERR + 62,
|
|
||||||
WSAENAMETOOLONG = WSABASEERR + 63,
|
|
||||||
WSAEHOSTDOWN = WSABASEERR + 64,
|
|
||||||
WSAEHOSTUNREACH = WSABASEERR + 65,
|
|
||||||
WSAENOTEMPTY = WSABASEERR + 66,
|
|
||||||
WSAEPROCLIM = WSABASEERR + 67,
|
|
||||||
WSAEUSERS = WSABASEERR + 68,
|
|
||||||
WSAEDQUOT = WSABASEERR + 69,
|
|
||||||
WSAESTALE = WSABASEERR + 70,
|
|
||||||
WSAEREMOTE = WSABASEERR + 71,
|
|
||||||
|
|
||||||
WSASYSNOTREADY = WSABASEERR + 91,
|
|
||||||
WSAVERNOTSUPPORTED = WSABASEERR + 92,
|
|
||||||
WSANOTINITIALISED = WSABASEERR + 93,
|
|
||||||
WSAEDISCON = WSABASEERR + 101,
|
|
||||||
WSAENOMORE = WSABASEERR + 102,
|
|
||||||
WSAECANCELLED = WSABASEERR + 103,
|
|
||||||
WSAEINVALIDPROCTABLE = WSABASEERR + 104,
|
|
||||||
WSAEINVALIDPROVIDER = WSABASEERR + 105,
|
|
||||||
WSAEPROVIDERFAILEDINIT = WSABASEERR + 106,
|
|
||||||
WSASYSCALLFAILURE = WSABASEERR + 107,
|
|
||||||
WSASERVICE_NOT_FOUND = WSABASEERR + 108,
|
|
||||||
WSATYPE_NOT_FOUND = WSABASEERR + 109,
|
|
||||||
WSA_E_NO_MORE = WSABASEERR + 110,
|
|
||||||
WSA_E_CANCELLED = WSABASEERR + 111,
|
|
||||||
WSAEREFUSED = WSABASEERR + 112,
|
|
||||||
|
|
||||||
WSAHOST_NOT_FOUND = WSABASEERR + 1001,
|
|
||||||
WSATRY_AGAIN = WSABASEERR + 1002,
|
|
||||||
WSANO_RECOVERY = WSABASEERR + 1003,
|
|
||||||
WSANO_DATA = WSABASEERR + 1004,
|
|
||||||
|
|
||||||
WSA_QOS_RECEIVERS = WSABASEERR + 1005,
|
|
||||||
WSA_QOS_SENDERS = WSABASEERR + 1006,
|
|
||||||
WSA_QOS_NO_SENDERS = WSABASEERR + 1007,
|
|
||||||
WSA_QOS_NO_RECEIVERS = WSABASEERR + 1008,
|
|
||||||
WSA_QOS_REQUEST_CONFIRMED = WSABASEERR + 1009,
|
|
||||||
WSA_QOS_ADMISSION_FAILURE = WSABASEERR + 1010,
|
|
||||||
WSA_QOS_POLICY_FAILURE = WSABASEERR + 1011,
|
|
||||||
WSA_QOS_BAD_STYLE = WSABASEERR + 1012,
|
|
||||||
WSA_QOS_BAD_OBJECT = WSABASEERR + 1013,
|
|
||||||
|
|
||||||
WSA_QOS_TRAFFIC_CTRL_ERROR = WSABASEERR + 1014,
|
|
||||||
WSA_QOS_GENERIC_ERROR = WSABASEERR + 1015,
|
|
||||||
WSA_QOS_ESERVICETYPE = WSABASEERR + 1016,
|
|
||||||
WSA_QOS_EFLOWSPEC = WSABASEERR + 1017,
|
|
||||||
WSA_QOS_EPROVSPECBUF = WSABASEERR + 1018,
|
|
||||||
WSA_QOS_EFILTERSTYLE = WSABASEERR + 1019,
|
|
||||||
WSA_QOS_EFILTERTYPE = WSABASEERR + 1020,
|
|
||||||
WSA_QOS_EFILTERCOUNT = WSABASEERR + 1021,
|
|
||||||
WSA_QOS_EOBJLENGTH = WSABASEERR + 1022,
|
|
||||||
WSA_QOS_EFLOWCOUNT = WSABASEERR + 1023,
|
|
||||||
WSA_QOS_EUNKOWNPSOBJ = WSABASEERR + 1024,
|
|
||||||
WSA_QOS_EPOLICYOBJ = WSABASEERR + 1025,
|
|
||||||
WSA_QOS_EFLOWDESC = WSABASEERR + 1026,
|
|
||||||
WSA_QOS_EPSFLOWSPEC = WSABASEERR + 1027,
|
|
||||||
WSA_QOS_EPSFILTERSPEC = WSABASEERR + 1028,
|
|
||||||
WSA_QOS_ESDMODEOBJ = WSABASEERR + 1029,
|
|
||||||
WSA_QOS_ESHAPERATEOBJ = WSABASEERR + 1030,
|
|
||||||
WSA_QOS_RESERVED_PETYPE = WSABASEERR + 1031,
|
|
||||||
}
|
|
@ -15,6 +15,5 @@ module tanya.sys.windows;
|
|||||||
version (Windows):
|
version (Windows):
|
||||||
|
|
||||||
public import tanya.sys.windows.def;
|
public import tanya.sys.windows.def;
|
||||||
public import tanya.sys.windows.error;
|
|
||||||
public import tanya.sys.windows.winbase;
|
public import tanya.sys.windows.winbase;
|
||||||
public import tanya.sys.windows.winsock2;
|
public import tanya.sys.windows.winsock2;
|
||||||
|
@ -20,63 +20,6 @@ module tanya.typecons;
|
|||||||
import tanya.format;
|
import tanya.format;
|
||||||
import tanya.meta.metafunction : AliasSeq, AliasTuple = Tuple, Map;
|
import tanya.meta.metafunction : AliasSeq, AliasTuple = Tuple, Map;
|
||||||
|
|
||||||
deprecated("Use tanya.typecons.Tuple instead")
|
|
||||||
template Pair(Specs...)
|
|
||||||
{
|
|
||||||
template parseSpecs(size_t fieldCount, Specs...)
|
|
||||||
{
|
|
||||||
static if (Specs.length == 0)
|
|
||||||
{
|
|
||||||
alias parseSpecs = AliasSeq!();
|
|
||||||
}
|
|
||||||
else static if (is(Specs[0]) && fieldCount < 2)
|
|
||||||
{
|
|
||||||
static if (is(typeof(Specs[1]) == string))
|
|
||||||
{
|
|
||||||
alias parseSpecs
|
|
||||||
= AliasSeq!(AliasTuple!(Specs[0], Specs[1]),
|
|
||||||
parseSpecs!(fieldCount + 1, Specs[2 .. $]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alias parseSpecs
|
|
||||||
= AliasSeq!(AliasTuple!(Specs[0]),
|
|
||||||
parseSpecs!(fieldCount + 1, Specs[1 .. $]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
static assert(false, "Invalid argument: " ~ Specs[0].stringof);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
alias ChooseType(alias T) = T.Seq[0];
|
|
||||||
alias ParsedSpecs = parseSpecs!(0, Specs);
|
|
||||||
|
|
||||||
static assert(ParsedSpecs.length == 2, "Invalid argument count");
|
|
||||||
|
|
||||||
struct Pair
|
|
||||||
{
|
|
||||||
/// Field types.
|
|
||||||
alias Types = Map!(ChooseType, ParsedSpecs);
|
|
||||||
|
|
||||||
// Create field aliases.
|
|
||||||
static if (ParsedSpecs[0].length == 2)
|
|
||||||
{
|
|
||||||
mixin("alias " ~ ParsedSpecs[0][1] ~ " = expand[0];");
|
|
||||||
}
|
|
||||||
static if (ParsedSpecs[1].length == 2)
|
|
||||||
{
|
|
||||||
mixin("alias " ~ ParsedSpecs[1][1] ~ " = expand[1];");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Represents the values of the $(D_PSYMBOL Pair) as a list of values.
|
|
||||||
Types expand;
|
|
||||||
|
|
||||||
alias expand this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $(D_PSYMBOL Tuple) can store two or more heterogeneous objects.
|
* $(D_PSYMBOL Tuple) can store two or more heterogeneous objects.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user