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.algorithm, std.conv, std.functional, std.stdio, std.range, std.traits, std.typetuple, std.typecons; | |
pragma(importpath, "dranges=https://raw.github.com/dawgfoto/dranges/master"); | |
import dranges.functional; | |
pragma(build, dranges); | |
Permute!Ranges permute(Ranges...)(Ranges ranges) | |
{ | |
return typeof(return)(ranges); | |
} |
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 std.regionallocator; | |
import std.algorithm, std.conv, std.exception, std.traits, std.typecons; | |
import core.bitop, core.exception, core.memory; | |
interface Allocator { | |
enum alignment = 1; | |
enum isAutomatic = false; | |
enum isScoped = false; | |
enum freeIsChecked = false; |
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.algorithm, std.exception, std.random, std.range, std.stdio; | |
PowerSet!R powerSet(R)(R range) if(isRandomAccessRange!R) | |
{ | |
return typeof(return)(range); | |
} | |
auto powerSet(R)(R range) if(!isRandomAccessRange!R && !isInfinite!R) | |
{ | |
return powerSet(array(range)); |
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 core.bitop, core.cpuid; | |
version (D_InlineAsm_X86) | |
{ | |
enum GeneralPurposeRegs : string | |
{ | |
AX = "EAX", | |
CX = "ECX", | |
DX = "EDX", | |
BX = "EBX", |
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.ascii, std.algorithm, std.conv, std.range, std.stdio, std.string; | |
ulong fromHexDigit(dchar c) { | |
if (!isHexDigit(c)) | |
throw new Exception("Illegal char in hex number: "~to!string(c)); | |
return c <= '9' ? (c & 0xF) : 9 + (c & 0xF); | |
} | |
ulong fromBinDigit(dchar c) { | |
if (c == '0') return 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
module buffered_range; | |
import std.algorithm, std.conv, std.exception, std.range, std.traits, std.typecons; | |
import core.memory, core.stdc.stdlib; | |
/* | |
* Adds the save function to an input range thus promoting | |
* it to a forward range. This is done by buffering the input range | |
* in blocks of size blockSize. | |
*/ |
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.random, std.traits, std.typecons, std.typetuple; | |
struct Builder(UserGens...) | |
{ | |
Tuple!TS genTuple(TS...)() | |
{ | |
Tuple!TS tup; | |
foreach(i, T; TS) | |
tup[i] = gen!T(); | |
return tup; |
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 "array.hpp" | |
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
// This is header only, so we just need to create an empty compile unit. |
OlderNewer