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
@-moz-document regexp("https?://(www\.|forum\.)?dlang.org/(|library|library-prerelease|phobos|phobos-prerelease|spec)(.*)") { | |
body { | |
color: #BFBFBF !important; | |
background-color: #222 !important; | |
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAACVBMVEUaGhohISElJSUh9lebAAAB20lEQVRIx4XWuZXDMAwE0C0SAQtggIIYoAAEU+aKOHhYojTrYP2+QfOW/5QIJOih/q8HwF/pb3EX+UPIveYcQGgEHiu9hI+ihEc5Jz5KBIlRRRaJ1JtoSAl5Hw96hLB1/up1tnIXOck5jZQy+3iU2hAOKSH1JvwxHsp+5TLF5MOl1/MQXsVs1miXc+KDbYydyMeUgpPQreZ7fWidbNhkXNJSeAhc6qHmHD8AYovunYyEACWEbyIhNeB9fRrH3hFi0bGPLuEW7xCNaohw1vAlS805nfsrTspclB/hVdoqusg53eH7FWot+wjYpOViX8KbFFKTwlnzvj65P9H/vD0/hibYBGhPwlPO8TmxRsaxsNnrUmUXpNhirlJMPr6Hqq9k5Xn/8iYQHYIuQsWFC6Z87IOxLxHphSY4SpuiU87xJnJr5axfeRd+lnMExXpEWPpuZ1v7qZdNBOjiHzDREHX5fs5Zz9p6X0vVKbKKchlSl5rv+3p//FJ/PYvoKryI8vs+2G9lzRmnEKkh+BU8yDk515jDj/HAswu7CCz6U/Mxb/PnC9N41ndpU4hUU7JGk/C9PmP/M2xZYdvBW2PObyf1IUiIzoHmHW9yTncliYs9A9tVNppdShfgQaTLMf+j3X723tLeHgAAAABJRU5ErkJggg==) !important; | |
background-cl |
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.traits : FunctionAttribute; | |
private string faToString(FunctionAttribute fa) | |
{ | |
import std.algorithm, std.traits; | |
string result; | |
foreach (member; __traits(derivedMembers, FunctionAttribute)) | |
{ | |
if (fa & __traits(getMember, FunctionAttribute, member)) |
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
// Suggested in http://forum.dlang.org/post/[email protected] | |
// TODO: constraints for needle search aren't accurate | |
/// | |
template randomSlideToFront(alias pred = "a == b") | |
{ | |
import std.random : isUniformRNG; | |
import std.range.primitives; | |
import std.traits : ifTestable; |
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
/** | |
* Reference counted closures. | |
* | |
* version = with_new_trait supports postblitting and destruction of upvalues, | |
* but depends on a hypothetical new language-level trait. | |
* | |
* The new trait, __traits(upvalues, func), would take an alias to a function | |
* and return an alias sequence containing a description of its upvalues: | |
* | |
* (T1, ptrdiff_t offset1, T2, ptrdiff_t offset2, ...) |
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
/// Returns true iff $(D func(args)) can be evaluated at compile-time | |
/// and doesn't error when evaluated. | |
template runsWithoutError(alias func, args...) | |
if(__traits(compiles, func(args))) | |
{ | |
// Wrapper anon func so it works with `func`s that have void return type | |
enum exec() = () { func(args); return true; /* never used */ }(); | |
//enum runsWithoutError = exec!(); | |
enum runsWithoutError = __traits(compiles, exec!()); | |
} |
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.traits : isCallable; | |
private auto curryImpl(F, CurriedArgs...)(F f, CurriedArgs curriedArgs) | |
{ | |
import std.traits : ParameterTypeTuple; | |
alias Args = ParameterTypeTuple!F; | |
static if(CurriedArgs.length == Args.length - 1) | |
return (Args[CurriedArgs.length] lastArg) => f(curriedArgs, lastArg); |
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.traits : isFunctionPointer; | |
private struct Curry(uint n, F...) | |
if(F.length == 1) | |
{ | |
import std.traits : ParameterTypeTuple; | |
alias Args = ParameterTypeTuple!F; | |
static if(is(F[0])) |
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
alias Identity(alias sym) = sym; | |
template ClassesInModule(alias mod) | |
{ | |
import std.typetuple : Filter, staticMap; | |
enum isAccessibleClassDeclaration(string member) = __traits(compiles, __traits(getMember, mod, member)) && | |
is(Identity!(__traits(getMember, mod, member)) == class); | |
alias LookupMemberType(string member) = Identity!(__traits(getMember, mod, member)); |
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 FuzzyOptions | |
{ | |
none, | |
levenshtein, | |
caseInsensitive | |
} | |
template fuzzyTo(Enum, FuzzyOptions options = FuzzyOptions.levenshtein | FuzzyOptions.caseInsensitive) | |
if (is(Enum == enum)) | |
{ |
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
class Foo | |
{ | |
string name; | |
this(string name) | |
{ | |
this.name = name; | |
} | |
} |
NewerOlder