Update compiler version list in the README

This commit is contained in:
2017-09-02 09:48:28 +02:00
parent 515bf619e8
commit 34b79ad46e
3 changed files with 417 additions and 383 deletions

File diff suppressed because it is too large Load Diff

View File

@ -414,7 +414,8 @@ version (TanyaPhobos)
hasElaborateCopyConstructor,
hasElaborateAssign,
EnumMembers,
classInstanceAlignment;
classInstanceAlignment,
ifTestable;
}
else:
@ -2685,3 +2686,44 @@ pure nothrow @safe @nogc unittest
}
static assert(classInstanceAlignment!C2 == S.alignof);
}
/**
* Tests whether $(D_INLINECODE pred(T)) can be used as condition in an
* $(D_KEYWORD if)-statement or a ternary operator.
*
* $(D_PARAM pred) is an optional parameter. By default $(D_PSYMBOL ifTestable)
* tests whether $(D_PARAM T) itself is usable as condition in an
* $(D_KEYWORD if)-statement or a ternary operator, i.e. if it a value of type
* $(D_PARAM T) can be converted to a boolean.
*
* Params:
* T = A type.
* pred = Function with one argument.
*
* Returns: $(D_KEYWORD true) if $(D_INLINECODE pred(T)) can be used as
* condition in an $(D_KEYWORD if)-statement or a ternary operator.
*/
template ifTestable(T, alias pred = a => a)
{
enum bool ifTestable = is(typeof(pred(T.init) ? true : false));
}
///
pure nothrow @safe @nogc unittest
{
static assert(ifTestable!int);
struct S1
{
}
static assert(!ifTestable!S1);
struct S2
{
bool opCast(T : bool)()
{
return true;
}
}
static assert(ifTestable!S2);
}