On 5/15/20 11:12 PM, Alex wrote:
static if(__traits(compiles, T.min))
writeln("Minimum value : ", T.min);
A little improvement:
static if(__traits(isFloating, T)) {
writeln("Minimum value : ", -T.max);
} else {
writeln("Minimum value : ", T.min);
}
On Saturday, 16 May 2020 at 05:22:49 UTC, n0den1te wrote:
[...]
For example, like this:
´´´
import std;
alias types = AliasSeq!(
bool, byte, ubyte, short, ushort, int, uint, long, ulong,
float, double, real, char, wchar, dchar
);
void main()
{
static foreach(type; types)
{
Hi,
I am working through the book 'Programming in D' and wanted
to take the sample program on
http://ddili.org/ders/d.en/types.html, one step further:
import std.stdio;
void main() {
writeln("Type : ", int.stringof);
writeln("Length in bytes: ",