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 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 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 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
#include <cstdio> | |
struct M | |
{ | |
int x; | |
M() { /* printf("M ctor %p\n", this); */ } | |
M(const M&) { printf("M cctor %p\n", this); } | |
M& operator=(const M&) { printf("M assgn %p\n", this); return *this; } | |
~M() { printf("M dtor %p\n", this); } | |
}; |
This file contains 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
void main() | |
{ | |
import std.stdio, std.meta : AliasSeq; | |
static foreach (T; AliasSeq!(S1, S2, S3, S4, S5, S6, T1, T2, T3, T4, T5, T6, C1, C2, C3, C4, C5, C6)) | |
{{ | |
auto tid = newTypeid!T; | |
pragma (msg, T, " -> ", typeof(tid.xtoHash)); | |
scope T x = make!T; | |
"newTypeid!%s(x).xtoHash() -> ".writef(T.stringof); | |
tid.xtoHash(x).writeln; |
This file contains 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
void main() | |
{ | |
struct S | |
{ | |
int a = 11; | |
string b = "22"; | |
bool c = true; | |
double d = 4.4; | |
char e = '5'; | |
int f = 66; |
This file contains 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
void main(string[] args) | |
{ | |
import std.process : userShell; | |
import std.stdio : writeln; | |
auto res = getProcessPath(args.length == 2? args[1] : userShell()); | |
res.writeln; | |
} | |
/++ | |
Gets the path to a command by running it and then using OS APIs to query |
This file contains 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.stdio; | |
int add0(int a, int b) { return a + b; } | |
int add1(int a, int b = 1) { return a + b; } | |
int add2(int a = 2, int b = 1) { return a + b; } | |
void main() | |
{ | |
wrapper!add0(10, 20).writeln; | |
wrapper!add1(10, 20).writeln; |
This file contains 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; | |
void main() | |
{ | |
alias NV = tuple; | |
auto arr = [NV("Steve", 1), NV("George", 500), NV("Adam", -5)]; | |
writefln("%(%(%s: %s%), %)", arr); | |
} |
I hereby claim:
- I am petarkirov on github.
- I am zombinedev (https://keybase.io/zombinedev) on keybase.
- I have a public key ASCA0YsistQoFVDfAnz7lwofsPa-p9KsgmJLPiejgiHt0wo
To claim this, I am signing this object: