| module | bare import time |
|---|---|
| std.regex | 1.04s |
| std.net.curl | 0.29s |
| std.zip | 0.19s |
| std.path | 0.15s |
| std.socket | 0.15s |
| std.file | 0.14s |
| std.mmfile | 0.14s |
| std.datetime | 0.14s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum isVar(T...) = | |
| __traits(compiles, { void foo(typeof(T[0]) arg) { } }) && | |
| __traits(compiles, &T[0]); | |
| int m = 42; | |
| int mt(T) = 42; | |
| const int c = 42; | |
| const int ct(T) = 42; | |
| immutable int i = 42; | |
| immutable int it(T) = 42; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /++ | |
| module rxd.meta2; | |
| # UFCS-enabled algorithms on alias sequences and "template lambdas" | |
| Building blocks: | |
| * `apply(fun, args...)` - applies `args` to `fun` where `fun` is either a | |
| function or template, through speculative evaluation. | |
| * `Π` - dependent (templated) Pi type, used for capturing compile-time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import core.sys.posix.sys.types : mode_t, pid_t; | |
| import core.sys.posix.signal : sigset_t; | |
| import core.sys.posix.sched : sched_param; | |
| import core.stdc.stdio : perror, printf; | |
| import core.stdc.errno : errno; | |
| import core.stdc.stdlib : exit, EXIT_FAILURE; | |
| void checkErrno(int err, const char* msg) | |
| { | |
| if (!err) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vibe-d | |
| sociomantic-tsunami/ocean | |
| dlang/dub | |
| higgsjs/Higgs | |
| rejectedsoftware/ddox | |
| BlackEdder/ggplotd | |
| eBay/tsv-utils-dlang | |
| dlang-community/D-Scanner | |
| dlang-tour/core | |
| d-widget-toolkit/dwt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import std.array : appender; | |
| import std.regex : regex, replaceAll; | |
| import std.string : format, indexOf, toUpper; | |
| import std.stdio : writeln; | |
| string getVariable(string var) | |
| { | |
| return "<%s>".format(var.toUpper); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import std.conv : to; | |
| import std.meta : ApplyLeft, Filter; | |
| import std.stdio : writef, writefln, writeln; | |
| import std.variant : Variant; | |
| void main() | |
| { | |
| auto c = new MyClass(); | |
| c.call("v0", [ ]); | |
| c.call("v1", [ Variant(42), Variant("test") ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| size_t bsearch(alias pred, uint start, uint end)() | |
| { | |
| static if (end <= start) | |
| static assert (0); | |
| else static if (start + 1 == end && pred!start) | |
| return start; | |
| else | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://forum.dlang.org/post/oxxydengmzzefjxjqgma@forum.dlang.org | |
| /+ CTRNG | |
| Proof-Of-Concept Compile-Time Random Number Generator. | |
| Please never actually use this or anything like it. | |
| While doing some metaprogramming tomfoolery, I stumbled into an | |
| interesting scenario. It occurred to me that with some work, I could | |
| probably turn what I had into a functioning compile-time random | |
| number generator, despite D's restrictions on metaprogramming intended |
Consider the following program:
@safe:
char[] formatInPlace(T)(char[] buf, T value);
void main()
{
char[1024] buffer;
formatInPlace(buffer[], 28.625);