Created
July 5, 2017 08:30
-
-
Save kotet/d06125b1d3b14f101742b1411d83c46f to your computer and use it in GitHub Desktop.
binary.h in D
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
mixin template binary(T) | |
{ | |
mixin(() { | |
import std.conv : to; | |
import std.range : chain, only, iota; | |
import std.string : rightJustify, format; | |
string result = ""; | |
foreach (n; iota(0, T.max).chain(T.max.only)) | |
{ | |
size_t maxlen = format("%b", T.max).length; | |
string representation = format("%b", n); | |
foreach (minWidth; representation.length .. maxlen + 1) | |
{ | |
result ~= "enum " ~ T.stringof ~ " B" ~ rightJustify(representation, | |
minWidth, '0') ~ " = " ~ to!string(n) ~ ";"; | |
} | |
} | |
return result; | |
}()); | |
} | |
unittest | |
{ | |
mixin binary!(ubyte); | |
} |
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 object; | |
template binary(T) | |
{ | |
mixin(() | |
{ | |
import std.conv : to; | |
import std.range : chain, only, iota; | |
import std.string : rightJustify, format; | |
string result = ""; | |
foreach (n; iota(0, T.max).chain(T.max.only)) | |
{ | |
size_t maxlen = format("%b", T.max).length; | |
string representation = format("%b", n); | |
foreach (minWidth; representation.length .. maxlen + 1) | |
{ | |
result ~= "enum " ~ T.stringof ~ " B" ~ rightJustify(representation, minWidth, '0') ~ " = " ~ to!string | |
(n) ~ ";"; | |
} | |
} | |
return result; | |
} | |
()); | |
} | |
unittest | |
{ | |
enum ubyte B0 = cast(ubyte)0u; | |
enum ubyte B00 = cast(ubyte)0u; | |
enum ubyte B000 = cast(ubyte)0u; | |
enum ubyte B0000 = cast(ubyte)0u; | |
enum ubyte B00000 = cast(ubyte)0u; | |
enum ubyte B000000 = cast(ubyte)0u; | |
enum ubyte B0000000 = cast(ubyte)0u; | |
enum ubyte B00000000 = cast(ubyte)0u; | |
enum ubyte B1 = cast(ubyte)1u; | |
enum ubyte B01 = cast(ubyte)1u; | |
enum ubyte B001 = cast(ubyte)1u; | |
enum ubyte B0001 = cast(ubyte)1u; | |
enum ubyte B00001 = cast(ubyte)1u; | |
enum ubyte B000001 = cast(ubyte)1u; | |
enum ubyte B0000001 = cast(ubyte)1u; | |
enum ubyte B00000001 = cast(ubyte)1u; | |
enum ubyte B10 = cast(ubyte)2u; | |
enum ubyte B010 = cast(ubyte)2u; | |
enum ubyte B0010 = cast(ubyte)2u; | |
enum ubyte B00010 = cast(ubyte)2u; | |
enum ubyte B000010 = cast(ubyte)2u; | |
enum ubyte B0000010 = cast(ubyte)2u; | |
enum ubyte B00000010 = cast(ubyte)2u; | |
enum ubyte B11 = cast(ubyte)3u; | |
enum ubyte B011 = cast(ubyte)3u; | |
enum ubyte B0011 = cast(ubyte)3u; | |
enum ubyte B00011 = cast(ubyte)3u; | |
enum ubyte B000011 = cast(ubyte)3u; | |
enum ubyte B0000011 = cast(ubyte)3u; | |
enum ubyte B00000011 = cast(ubyte)3u; | |
enum ubyte B100 = cast(ubyte)4u; | |
enum ubyte B0100 = cast(ubyte)4u; | |
enum ubyte B00100 = cast(ubyte)4u; | |
enum ubyte B000100 = cast(ubyte)4u; | |
enum ubyte B0000100 = cast(ubyte)4u; | |
enum ubyte B00000100 = cast(ubyte)4u; | |
enum ubyte B101 = cast(ubyte)5u; | |
enum ubyte B0101 = cast(ubyte)5u; | |
enum ubyte B00101 = cast(ubyte)5u; | |
enum ubyte B000101 = cast(ubyte)5u; | |
enum ubyte B0000101 = cast(ubyte)5u; | |
enum ubyte B00000101 = cast(ubyte)5u; | |
enum ubyte B110 = cast(ubyte)6u; | |
enum ubyte B0110 = cast(ubyte)6u; | |
enum ubyte B00110 = cast(ubyte)6u; | |
enum ubyte B000110 = cast(ubyte)6u; | |
enum ubyte B0000110 = cast(ubyte)6u; | |
enum ubyte B00000110 = cast(ubyte)6u; | |
enum ubyte B111 = cast(ubyte)7u; | |
enum ubyte B0111 = cast(ubyte)7u; | |
enum ubyte B00111 = cast(ubyte)7u; | |
enum ubyte B000111 = cast(ubyte)7u; | |
enum ubyte B0000111 = cast(ubyte)7u; | |
enum ubyte B00000111 = cast(ubyte)7u; | |
enum ubyte B1000 = cast(ubyte)8u; | |
enum ubyte B01000 = cast(ubyte)8u; | |
enum ubyte B001000 = cast(ubyte)8u; | |
enum ubyte B0001000 = cast(ubyte)8u; | |
enum ubyte B00001000 = cast(ubyte)8u; | |
enum ubyte B1001 = cast(ubyte)9u; | |
enum ubyte B01001 = cast(ubyte)9u; | |
enum ubyte B001001 = cast(ubyte)9u; | |
enum ubyte B0001001 = cast(ubyte)9u; | |
enum ubyte B00001001 = cast(ubyte)9u; | |
enum ubyte B1010 = cast(ubyte)10u; | |
enum ubyte B01010 = cast(ubyte)10u; | |
enum ubyte B001010 = cast(ubyte)10u; | |
enum ubyte B0001010 = cast(ubyte)10u; | |
enum ubyte B00001010 = cast(ubyte)10u; | |
enum ubyte B1011 = cast(ubyte)11u; | |
enum ubyte B01011 = cast(ubyte)11u; | |
enum ubyte B001011 = cast(ubyte)11u; | |
enum ubyte B0001011 = cast(ubyte)11u; | |
enum ubyte B00001011 = cast(ubyte)11u; | |
enum ubyte B1100 = cast(ubyte)12u; | |
enum ubyte B01100 = cast(ubyte)12u; | |
enum ubyte B001100 = cast(ubyte)12u; | |
enum ubyte B0001100 = cast(ubyte)12u; | |
enum ubyte B00001100 = cast(ubyte)12u; | |
enum ubyte B1101 = cast(ubyte)13u; | |
enum ubyte B01101 = cast(ubyte)13u; | |
enum ubyte B001101 = cast(ubyte)13u; | |
enum ubyte B0001101 = cast(ubyte)13u; | |
enum ubyte B00001101 = cast(ubyte)13u; | |
enum ubyte B1110 = cast(ubyte)14u; | |
enum ubyte B01110 = cast(ubyte)14u; | |
enum ubyte B001110 = cast(ubyte)14u; | |
enum ubyte B0001110 = cast(ubyte)14u; | |
enum ubyte B00001110 = cast(ubyte)14u; | |
enum ubyte B1111 = cast(ubyte)15u; | |
enum ubyte B01111 = cast(ubyte)15u; | |
enum ubyte B001111 = cast(ubyte)15u; | |
enum ubyte B0001111 = cast(ubyte)15u; | |
enum ubyte B00001111 = cast(ubyte)15u; | |
enum ubyte B10000 = cast(ubyte)16u; | |
enum ubyte B010000 = cast(ubyte)16u; | |
enum ubyte B0010000 = cast(ubyte)16u; | |
enum ubyte B00010000 = cast(ubyte)16u; | |
enum ubyte B10001 = cast(ubyte)17u; | |
enum ubyte B010001 = cast(ubyte)17u; | |
enum ubyte B0010001 = cast(ubyte)17u; | |
enum ubyte B00010001 = cast(ubyte)17u; | |
enum ubyte B10010 = cast(ubyte)18u; | |
enum ubyte B010010 = cast(ubyte)18u; | |
enum ubyte B0010010 = cast(ubyte)18u; | |
enum ubyte B00010010 = cast(ubyte)18u; | |
enum ubyte B10011 = cast(ubyte)19u; | |
enum ubyte B010011 = cast(ubyte)19u; | |
enum ubyte B0010011 = cast(ubyte)19u; | |
enum ubyte B00010011 = cast(ubyte)19u; | |
enum ubyte B10100 = cast(ubyte)20u; | |
enum ubyte B010100 = cast(ubyte)20u; | |
enum ubyte B0010100 = cast(ubyte)20u; | |
enum ubyte B00010100 = cast(ubyte)20u; | |
enum ubyte B10101 = cast(ubyte)21u; | |
enum ubyte B010101 = cast(ubyte)21u; | |
enum ubyte B0010101 = cast(ubyte)21u; | |
enum ubyte B00010101 = cast(ubyte)21u; | |
enum ubyte B10110 = cast(ubyte)22u; | |
enum ubyte B010110 = cast(ubyte)22u; | |
enum ubyte B0010110 = cast(ubyte)22u; | |
enum ubyte B00010110 = cast(ubyte)22u; | |
enum ubyte B10111 = cast(ubyte)23u; | |
enum ubyte B010111 = cast(ubyte)23u; | |
enum ubyte B0010111 = cast(ubyte)23u; | |
enum ubyte B00010111 = cast(ubyte)23u; | |
enum ubyte B11000 = cast(ubyte)24u; | |
enum ubyte B011000 = cast(ubyte)24u; | |
enum ubyte B0011000 = cast(ubyte)24u; | |
enum ubyte B00011000 = cast(ubyte)24u; | |
enum ubyte B11001 = cast(ubyte)25u; | |
enum ubyte B011001 = cast(ubyte)25u; | |
enum ubyte B0011001 = cast(ubyte)25u; | |
enum ubyte B00011001 = cast(ubyte)25u; | |
enum ubyte B11010 = cast(ubyte)26u; | |
enum ubyte B011010 = cast(ubyte)26u; | |
enum ubyte B0011010 = cast(ubyte)26u; | |
enum ubyte B00011010 = cast(ubyte)26u; | |
enum ubyte B11011 = cast(ubyte)27u; | |
enum ubyte B011011 = cast(ubyte)27u; | |
enum ubyte B0011011 = cast(ubyte)27u; | |
enum ubyte B00011011 = cast(ubyte)27u; | |
enum ubyte B11100 = cast(ubyte)28u; | |
enum ubyte B011100 = cast(ubyte)28u; | |
enum ubyte B0011100 = cast(ubyte)28u; | |
enum ubyte B00011100 = cast(ubyte)28u; | |
enum ubyte B11101 = cast(ubyte)29u; | |
enum ubyte B011101 = cast(ubyte)29u; | |
enum ubyte B0011101 = cast(ubyte)29u; | |
enum ubyte B00011101 = cast(ubyte)29u; | |
enum ubyte B11110 = cast(ubyte)30u; | |
enum ubyte B011110 = cast(ubyte)30u; | |
enum ubyte B0011110 = cast(ubyte)30u; | |
enum ubyte B00011110 = cast(ubyte)30u; | |
enum ubyte B11111 = cast(ubyte)31u; | |
enum ubyte B011111 = cast(ubyte)31u; | |
enum ubyte B0011111 = cast(ubyte)31u; | |
enum ubyte B00011111 = cast(ubyte)31u; | |
enum ubyte B100000 = cast(ubyte)32u; | |
enum ubyte B0100000 = cast(ubyte)32u; | |
enum ubyte B00100000 = cast(ubyte)32u; | |
enum ubyte B100001 = cast(ubyte)33u; | |
enum ubyte B0100001 = cast(ubyte)33u; | |
enum ubyte B00100001 = cast(ubyte)33u; | |
enum ubyte B100010 = cast(ubyte)34u; | |
enum ubyte B0100010 = cast(ubyte)34u; | |
enum ubyte B00100010 = cast(ubyte)34u; | |
enum ubyte B100011 = cast(ubyte)35u; | |
enum ubyte B0100011 = cast(ubyte)35u; | |
enum ubyte B00100011 = cast(ubyte)35u; | |
enum ubyte B100100 = cast(ubyte)36u; | |
enum ubyte B0100100 = cast(ubyte)36u; | |
enum ubyte B00100100 = cast(ubyte)36u; | |
enum ubyte B100101 = cast(ubyte)37u; | |
enum ubyte B0100101 = cast(ubyte)37u; | |
enum ubyte B00100101 = cast(ubyte)37u; | |
enum ubyte B100110 = cast(ubyte)38u; | |
enum ubyte B0100110 = cast(ubyte)38u; | |
enum ubyte B00100110 = cast(ubyte)38u; | |
enum ubyte B100111 = cast(ubyte)39u; | |
enum ubyte B0100111 = cast(ubyte)39u; | |
enum ubyte B00100111 = cast(ubyte)39u; | |
enum ubyte B101000 = cast(ubyte)40u; | |
enum ubyte B0101000 = cast(ubyte)40u; | |
enum ubyte B00101000 = cast(ubyte)40u; | |
enum ubyte B101001 = cast(ubyte)41u; | |
enum ubyte B0101001 = cast(ubyte)41u; | |
enum ubyte B00101001 = cast(ubyte)41u; | |
enum ubyte B101010 = cast(ubyte)42u; | |
enum ubyte B0101010 = cast(ubyte)42u; | |
enum ubyte B00101010 = cast(ubyte)42u; | |
enum ubyte B101011 = cast(ubyte)43u; | |
enum ubyte B0101011 = cast(ubyte)43u; | |
enum ubyte B00101011 = cast(ubyte)43u; | |
enum ubyte B101100 = cast(ubyte)44u; | |
enum ubyte B0101100 = cast(ubyte)44u; | |
enum ubyte B00101100 = cast(ubyte)44u; | |
enum ubyte B101101 = cast(ubyte)45u; | |
enum ubyte B0101101 = cast(ubyte)45u; | |
enum ubyte B00101101 = cast(ubyte)45u; | |
enum ubyte B101110 = cast(ubyte)46u; | |
enum ubyte B0101110 = cast(ubyte)46u; | |
enum ubyte B00101110 = cast(ubyte)46u; | |
enum ubyte B101111 = cast(ubyte)47u; | |
enum ubyte B0101111 = cast(ubyte)47u; | |
enum ubyte B00101111 = cast(ubyte)47u; | |
enum ubyte B110000 = cast(ubyte)48u; | |
enum ubyte B0110000 = cast(ubyte)48u; | |
enum ubyte B00110000 = cast(ubyte)48u; | |
enum ubyte B110001 = cast(ubyte)49u; | |
enum ubyte B0110001 = cast(ubyte)49u; | |
enum ubyte B00110001 = cast(ubyte)49u; | |
enum ubyte B110010 = cast(ubyte)50u; | |
enum ubyte B0110010 = cast(ubyte)50u; | |
enum ubyte B00110010 = cast(ubyte)50u; | |
enum ubyte B110011 = cast(ubyte)51u; | |
enum ubyte B0110011 = cast(ubyte)51u; | |
enum ubyte B00110011 = cast(ubyte)51u; | |
enum ubyte B110100 = cast(ubyte)52u; | |
enum ubyte B0110100 = cast(ubyte)52u; | |
enum ubyte B00110100 = cast(ubyte)52u; | |
enum ubyte B110101 = cast(ubyte)53u; | |
enum ubyte B0110101 = cast(ubyte)53u; | |
enum ubyte B00110101 = cast(ubyte)53u; | |
enum ubyte B110110 = cast(ubyte)54u; | |
enum ubyte B0110110 = cast(ubyte)54u; | |
enum ubyte B00110110 = cast(ubyte)54u; | |
enum ubyte B110111 = cast(ubyte)55u; | |
enum ubyte B0110111 = cast(ubyte)55u; | |
enum ubyte B00110111 = cast(ubyte)55u; | |
enum ubyte B111000 = cast(ubyte)56u; | |
enum ubyte B0111000 = cast(ubyte)56u; | |
enum ubyte B00111000 = cast(ubyte)56u; | |
enum ubyte B111001 = cast(ubyte)57u; | |
enum ubyte B0111001 = cast(ubyte)57u; | |
enum ubyte B00111001 = cast(ubyte)57u; | |
enum ubyte B111010 = cast(ubyte)58u; | |
enum ubyte B0111010 = cast(ubyte)58u; | |
enum ubyte B00111010 = cast(ubyte)58u; | |
enum ubyte B111011 = cast(ubyte)59u; | |
enum ubyte B0111011 = cast(ubyte)59u; | |
enum ubyte B00111011 = cast(ubyte)59u; | |
enum ubyte B111100 = cast(ubyte)60u; | |
enum ubyte B0111100 = cast(ubyte)60u; | |
enum ubyte B00111100 = cast(ubyte)60u; | |
enum ubyte B111101 = cast(ubyte)61u; | |
enum ubyte B0111101 = cast(ubyte)61u; | |
enum ubyte B00111101 = cast(ubyte)61u; | |
enum ubyte B111110 = cast(ubyte)62u; | |
enum ubyte B0111110 = cast(ubyte)62u; | |
enum ubyte B00111110 = cast(ubyte)62u; | |
enum ubyte B111111 = cast(ubyte)63u; | |
enum ubyte B0111111 = cast(ubyte)63u; | |
enum ubyte B00111111 = cast(ubyte)63u; | |
enum ubyte B1000000 = cast(ubyte)64u; | |
enum ubyte B01000000 = cast(ubyte)64u; | |
enum ubyte B1000001 = cast(ubyte)65u; | |
enum ubyte B01000001 = cast(ubyte)65u; | |
enum ubyte B1000010 = cast(ubyte)66u; | |
enum ubyte B01000010 = cast(ubyte)66u; | |
enum ubyte B1000011 = cast(ubyte)67u; | |
enum ubyte B01000011 = cast(ubyte)67u; | |
enum ubyte B1000100 = cast(ubyte)68u; | |
enum ubyte B01000100 = cast(ubyte)68u; | |
enum ubyte B1000101 = cast(ubyte)69u; | |
enum ubyte B01000101 = cast(ubyte)69u; | |
enum ubyte B1000110 = cast(ubyte)70u; | |
enum ubyte B01000110 = cast(ubyte)70u; | |
enum ubyte B1000111 = cast(ubyte)71u; | |
enum ubyte B01000111 = cast(ubyte)71u; | |
enum ubyte B1001000 = cast(ubyte)72u; | |
enum ubyte B01001000 = cast(ubyte)72u; | |
enum ubyte B1001001 = cast(ubyte)73u; | |
enum ubyte B01001001 = cast(ubyte)73u; | |
enum ubyte B1001010 = cast(ubyte)74u; | |
enum ubyte B01001010 = cast(ubyte)74u; | |
enum ubyte B1001011 = cast(ubyte)75u; | |
enum ubyte B01001011 = cast(ubyte)75u; | |
enum ubyte B1001100 = cast(ubyte)76u; | |
enum ubyte B01001100 = cast(ubyte)76u; | |
enum ubyte B1001101 = cast(ubyte)77u; | |
enum ubyte B01001101 = cast(ubyte)77u; | |
enum ubyte B1001110 = cast(ubyte)78u; | |
enum ubyte B01001110 = cast(ubyte)78u; | |
enum ubyte B1001111 = cast(ubyte)79u; | |
enum ubyte B01001111 = cast(ubyte)79u; | |
enum ubyte B1010000 = cast(ubyte)80u; | |
enum ubyte B01010000 = cast(ubyte)80u; | |
enum ubyte B1010001 = cast(ubyte)81u; | |
enum ubyte B01010001 = cast(ubyte)81u; | |
enum ubyte B1010010 = cast(ubyte)82u; | |
enum ubyte B01010010 = cast(ubyte)82u; | |
enum ubyte B1010011 = cast(ubyte)83u; | |
enum ubyte B01010011 = cast(ubyte)83u; | |
enum ubyte B1010100 = cast(ubyte)84u; | |
enum ubyte B01010100 = cast(ubyte)84u; | |
enum ubyte B1010101 = cast(ubyte)85u; | |
enum ubyte B01010101 = cast(ubyte)85u; | |
enum ubyte B1010110 = cast(ubyte)86u; | |
enum ubyte B01010110 = cast(ubyte)86u; | |
enum ubyte B1010111 = cast(ubyte)87u; | |
enum ubyte B01010111 = cast(ubyte)87u; | |
enum ubyte B1011000 = cast(ubyte)88u; | |
enum ubyte B01011000 = cast(ubyte)88u; | |
enum ubyte B1011001 = cast(ubyte)89u; | |
enum ubyte B01011001 = cast(ubyte)89u; | |
enum ubyte B1011010 = cast(ubyte)90u; | |
enum ubyte B01011010 = cast(ubyte)90u; | |
enum ubyte B1011011 = cast(ubyte)91u; | |
enum ubyte B01011011 = cast(ubyte)91u; | |
enum ubyte B1011100 = cast(ubyte)92u; | |
enum ubyte B01011100 = cast(ubyte)92u; | |
enum ubyte B1011101 = cast(ubyte)93u; | |
enum ubyte B01011101 = cast(ubyte)93u; | |
enum ubyte B1011110 = cast(ubyte)94u; | |
enum ubyte B01011110 = cast(ubyte)94u; | |
enum ubyte B1011111 = cast(ubyte)95u; | |
enum ubyte B01011111 = cast(ubyte)95u; | |
enum ubyte B1100000 = cast(ubyte)96u; | |
enum ubyte B01100000 = cast(ubyte)96u; | |
enum ubyte B1100001 = cast(ubyte)97u; | |
enum ubyte B01100001 = cast(ubyte)97u; | |
enum ubyte B1100010 = cast(ubyte)98u; | |
enum ubyte B01100010 = cast(ubyte)98u; | |
enum ubyte B1100011 = cast(ubyte)99u; | |
enum ubyte B01100011 = cast(ubyte)99u; | |
enum ubyte B1100100 = cast(ubyte)100u; | |
enum ubyte B01100100 = cast(ubyte)100u; | |
enum ubyte B1100101 = cast(ubyte)101u; | |
enum ubyte B01100101 = cast(ubyte)101u; | |
enum ubyte B1100110 = cast(ubyte)102u; | |
enum ubyte B01100110 = cast(ubyte)102u; | |
enum ubyte B1100111 = cast(ubyte)103u; | |
enum ubyte B01100111 = cast(ubyte)103u; | |
enum ubyte B1101000 = cast(ubyte)104u; | |
enum ubyte B01101000 = cast(ubyte)104u; | |
enum ubyte B1101001 = cast(ubyte)105u; | |
enum ubyte B01101001 = cast(ubyte)105u; | |
enum ubyte B1101010 = cast(ubyte)106u; | |
enum ubyte B01101010 = cast(ubyte)106u; | |
enum ubyte B1101011 = cast(ubyte)107u; | |
enum ubyte B01101011 = cast(ubyte)107u; | |
enum ubyte B1101100 = cast(ubyte)108u; | |
enum ubyte B01101100 = cast(ubyte)108u; | |
enum ubyte B1101101 = cast(ubyte)109u; | |
enum ubyte B01101101 = cast(ubyte)109u; | |
enum ubyte B1101110 = cast(ubyte)110u; | |
enum ubyte B01101110 = cast(ubyte)110u; | |
enum ubyte B1101111 = cast(ubyte)111u; | |
enum ubyte B01101111 = cast(ubyte)111u; | |
enum ubyte B1110000 = cast(ubyte)112u; | |
enum ubyte B01110000 = cast(ubyte)112u; | |
enum ubyte B1110001 = cast(ubyte)113u; | |
enum ubyte B01110001 = cast(ubyte)113u; | |
enum ubyte B1110010 = cast(ubyte)114u; | |
enum ubyte B01110010 = cast(ubyte)114u; | |
enum ubyte B1110011 = cast(ubyte)115u; | |
enum ubyte B01110011 = cast(ubyte)115u; | |
enum ubyte B1110100 = cast(ubyte)116u; | |
enum ubyte B01110100 = cast(ubyte)116u; | |
enum ubyte B1110101 = cast(ubyte)117u; | |
enum ubyte B01110101 = cast(ubyte)117u; | |
enum ubyte B1110110 = cast(ubyte)118u; | |
enum ubyte B01110110 = cast(ubyte)118u; | |
enum ubyte B1110111 = cast(ubyte)119u; | |
enum ubyte B01110111 = cast(ubyte)119u; | |
enum ubyte B1111000 = cast(ubyte)120u; | |
enum ubyte B01111000 = cast(ubyte)120u; | |
enum ubyte B1111001 = cast(ubyte)121u; | |
enum ubyte B01111001 = cast(ubyte)121u; | |
enum ubyte B1111010 = cast(ubyte)122u; | |
enum ubyte B01111010 = cast(ubyte)122u; | |
enum ubyte B1111011 = cast(ubyte)123u; | |
enum ubyte B01111011 = cast(ubyte)123u; | |
enum ubyte B1111100 = cast(ubyte)124u; | |
enum ubyte B01111100 = cast(ubyte)124u; | |
enum ubyte B1111101 = cast(ubyte)125u; | |
enum ubyte B01111101 = cast(ubyte)125u; | |
enum ubyte B1111110 = cast(ubyte)126u; | |
enum ubyte B01111110 = cast(ubyte)126u; | |
enum ubyte B1111111 = cast(ubyte)127u; | |
enum ubyte B01111111 = cast(ubyte)127u; | |
enum ubyte B10000000 = cast(ubyte)128u; | |
enum ubyte B10000001 = cast(ubyte)129u; | |
enum ubyte B10000010 = cast(ubyte)130u; | |
enum ubyte B10000011 = cast(ubyte)131u; | |
enum ubyte B10000100 = cast(ubyte)132u; | |
enum ubyte B10000101 = cast(ubyte)133u; | |
enum ubyte B10000110 = cast(ubyte)134u; | |
enum ubyte B10000111 = cast(ubyte)135u; | |
enum ubyte B10001000 = cast(ubyte)136u; | |
enum ubyte B10001001 = cast(ubyte)137u; | |
enum ubyte B10001010 = cast(ubyte)138u; | |
enum ubyte B10001011 = cast(ubyte)139u; | |
enum ubyte B10001100 = cast(ubyte)140u; | |
enum ubyte B10001101 = cast(ubyte)141u; | |
enum ubyte B10001110 = cast(ubyte)142u; | |
enum ubyte B10001111 = cast(ubyte)143u; | |
enum ubyte B10010000 = cast(ubyte)144u; | |
enum ubyte B10010001 = cast(ubyte)145u; | |
enum ubyte B10010010 = cast(ubyte)146u; | |
enum ubyte B10010011 = cast(ubyte)147u; | |
enum ubyte B10010100 = cast(ubyte)148u; | |
enum ubyte B10010101 = cast(ubyte)149u; | |
enum ubyte B10010110 = cast(ubyte)150u; | |
enum ubyte B10010111 = cast(ubyte)151u; | |
enum ubyte B10011000 = cast(ubyte)152u; | |
enum ubyte B10011001 = cast(ubyte)153u; | |
enum ubyte B10011010 = cast(ubyte)154u; | |
enum ubyte B10011011 = cast(ubyte)155u; | |
enum ubyte B10011100 = cast(ubyte)156u; | |
enum ubyte B10011101 = cast(ubyte)157u; | |
enum ubyte B10011110 = cast(ubyte)158u; | |
enum ubyte B10011111 = cast(ubyte)159u; | |
enum ubyte B10100000 = cast(ubyte)160u; | |
enum ubyte B10100001 = cast(ubyte)161u; | |
enum ubyte B10100010 = cast(ubyte)162u; | |
enum ubyte B10100011 = cast(ubyte)163u; | |
enum ubyte B10100100 = cast(ubyte)164u; | |
enum ubyte B10100101 = cast(ubyte)165u; | |
enum ubyte B10100110 = cast(ubyte)166u; | |
enum ubyte B10100111 = cast(ubyte)167u; | |
enum ubyte B10101000 = cast(ubyte)168u; | |
enum ubyte B10101001 = cast(ubyte)169u; | |
enum ubyte B10101010 = cast(ubyte)170u; | |
enum ubyte B10101011 = cast(ubyte)171u; | |
enum ubyte B10101100 = cast(ubyte)172u; | |
enum ubyte B10101101 = cast(ubyte)173u; | |
enum ubyte B10101110 = cast(ubyte)174u; | |
enum ubyte B10101111 = cast(ubyte)175u; | |
enum ubyte B10110000 = cast(ubyte)176u; | |
enum ubyte B10110001 = cast(ubyte)177u; | |
enum ubyte B10110010 = cast(ubyte)178u; | |
enum ubyte B10110011 = cast(ubyte)179u; | |
enum ubyte B10110100 = cast(ubyte)180u; | |
enum ubyte B10110101 = cast(ubyte)181u; | |
enum ubyte B10110110 = cast(ubyte)182u; | |
enum ubyte B10110111 = cast(ubyte)183u; | |
enum ubyte B10111000 = cast(ubyte)184u; | |
enum ubyte B10111001 = cast(ubyte)185u; | |
enum ubyte B10111010 = cast(ubyte)186u; | |
enum ubyte B10111011 = cast(ubyte)187u; | |
enum ubyte B10111100 = cast(ubyte)188u; | |
enum ubyte B10111101 = cast(ubyte)189u; | |
enum ubyte B10111110 = cast(ubyte)190u; | |
enum ubyte B10111111 = cast(ubyte)191u; | |
enum ubyte B11000000 = cast(ubyte)192u; | |
enum ubyte B11000001 = cast(ubyte)193u; | |
enum ubyte B11000010 = cast(ubyte)194u; | |
enum ubyte B11000011 = cast(ubyte)195u; | |
enum ubyte B11000100 = cast(ubyte)196u; | |
enum ubyte B11000101 = cast(ubyte)197u; | |
enum ubyte B11000110 = cast(ubyte)198u; | |
enum ubyte B11000111 = cast(ubyte)199u; | |
enum ubyte B11001000 = cast(ubyte)200u; | |
enum ubyte B11001001 = cast(ubyte)201u; | |
enum ubyte B11001010 = cast(ubyte)202u; | |
enum ubyte B11001011 = cast(ubyte)203u; | |
enum ubyte B11001100 = cast(ubyte)204u; | |
enum ubyte B11001101 = cast(ubyte)205u; | |
enum ubyte B11001110 = cast(ubyte)206u; | |
enum ubyte B11001111 = cast(ubyte)207u; | |
enum ubyte B11010000 = cast(ubyte)208u; | |
enum ubyte B11010001 = cast(ubyte)209u; | |
enum ubyte B11010010 = cast(ubyte)210u; | |
enum ubyte B11010011 = cast(ubyte)211u; | |
enum ubyte B11010100 = cast(ubyte)212u; | |
enum ubyte B11010101 = cast(ubyte)213u; | |
enum ubyte B11010110 = cast(ubyte)214u; | |
enum ubyte B11010111 = cast(ubyte)215u; | |
enum ubyte B11011000 = cast(ubyte)216u; | |
enum ubyte B11011001 = cast(ubyte)217u; | |
enum ubyte B11011010 = cast(ubyte)218u; | |
enum ubyte B11011011 = cast(ubyte)219u; | |
enum ubyte B11011100 = cast(ubyte)220u; | |
enum ubyte B11011101 = cast(ubyte)221u; | |
enum ubyte B11011110 = cast(ubyte)222u; | |
enum ubyte B11011111 = cast(ubyte)223u; | |
enum ubyte B11100000 = cast(ubyte)224u; | |
enum ubyte B11100001 = cast(ubyte)225u; | |
enum ubyte B11100010 = cast(ubyte)226u; | |
enum ubyte B11100011 = cast(ubyte)227u; | |
enum ubyte B11100100 = cast(ubyte)228u; | |
enum ubyte B11100101 = cast(ubyte)229u; | |
enum ubyte B11100110 = cast(ubyte)230u; | |
enum ubyte B11100111 = cast(ubyte)231u; | |
enum ubyte B11101000 = cast(ubyte)232u; | |
enum ubyte B11101001 = cast(ubyte)233u; | |
enum ubyte B11101010 = cast(ubyte)234u; | |
enum ubyte B11101011 = cast(ubyte)235u; | |
enum ubyte B11101100 = cast(ubyte)236u; | |
enum ubyte B11101101 = cast(ubyte)237u; | |
enum ubyte B11101110 = cast(ubyte)238u; | |
enum ubyte B11101111 = cast(ubyte)239u; | |
enum ubyte B11110000 = cast(ubyte)240u; | |
enum ubyte B11110001 = cast(ubyte)241u; | |
enum ubyte B11110010 = cast(ubyte)242u; | |
enum ubyte B11110011 = cast(ubyte)243u; | |
enum ubyte B11110100 = cast(ubyte)244u; | |
enum ubyte B11110101 = cast(ubyte)245u; | |
enum ubyte B11110110 = cast(ubyte)246u; | |
enum ubyte B11110111 = cast(ubyte)247u; | |
enum ubyte B11111000 = cast(ubyte)248u; | |
enum ubyte B11111001 = cast(ubyte)249u; | |
enum ubyte B11111010 = cast(ubyte)250u; | |
enum ubyte B11111011 = cast(ubyte)251u; | |
enum ubyte B11111100 = cast(ubyte)252u; | |
enum ubyte B11111101 = cast(ubyte)253u; | |
enum ubyte B11111110 = cast(ubyte)254u; | |
enum ubyte B11111111 = cast(ubyte)255u; | |
} | |
Demangle!uint | |
struct Demangle | |
{ | |
uint value; | |
string rest; | |
} | |
Flag!"unsafe" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
Flag!"pipeOnPop" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
opEquals!(CodepointInterval) | |
const pure nothrow @nogc @safe bool opEquals(CodepointInterval val) | |
{ | |
assert(&this, "null this"); | |
return this._tuple[0] == val._tuple[0] && this._tuple[1] == val._tuple[1]; | |
} | |
TrieEntry!(bool, 8, 4, 9) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
TrieEntry!(ushort, 8, 7, 6) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
TrieEntry!(bool, 8, 5, 8) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
TrieEntry!(bool, 8, 6, 7) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
TrieEntry!(bool, 7, 4, 4, 6) | |
struct TrieEntry | |
{ | |
@safe ulong[] offsets; | |
@safe ulong[] sizes; | |
@safe ulong[] data; | |
} | |
SliceOverIndexed!(Grapheme) | |
struct SliceOverIndexed | |
{ | |
enum bool assignableIndex = true; | |
enum bool assignableSlice = false; | |
auto const pure nothrow @nogc @safe dchar opIndex(ulong idx) | |
in | |
{ | |
assert(idx < this.to - this.from); | |
} | |
body | |
{ | |
{ | |
assert(idx < this.to - this.from); | |
} | |
assert(&this, "null this"); | |
return (*this.arr).opIndex(this.from + idx); | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @safe void opIndexAssign(dchar val, ulong idx) | |
in | |
{ | |
assert(idx < this.to - this.from); | |
} | |
body | |
{ | |
{ | |
assert(idx < this.to - this.from); | |
} | |
assert(&this, "null this"); | |
(*this.arr).opIndexAssign(val, this.from + idx); | |
} | |
} | |
auto pure nothrow @nogc @safe SliceOverIndexed!(Grapheme) opSlice(ulong a, ulong b) | |
{ | |
assert(&this, "null this"); | |
return SliceOverIndexed(this.from + a, this.from + b, this.arr); | |
} | |
void opSliceAssign(T)(T val, size_t start, size_t end) | |
{ | |
(*arr)[start + from..end + from] = val; | |
} | |
auto pure nothrow @nogc @safe SliceOverIndexed!(Grapheme) opSlice() | |
{ | |
assert(&this, "null this"); | |
return SliceOverIndexed(this.from, this.to, this.arr); | |
} | |
const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return this.to - this.from; | |
} | |
auto const pure nothrow @nogc @safe ulong opDollar() | |
{ | |
assert(&this, "null this"); | |
return this.length(); | |
} | |
const pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.from == this.to; | |
} | |
auto const pure nothrow @nogc @property @safe dchar front() | |
{ | |
assert(&this, "null this"); | |
return (*this.arr).opIndex(this.from); | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @property @safe void front(dchar val) | |
{ | |
assert(&this, "null this"); | |
(*this.arr).opIndexAssign(val, this.from); | |
} | |
} | |
auto const pure nothrow @nogc @property @safe dchar back() | |
{ | |
assert(&this, "null this"); | |
return (*this.arr).opIndex(this.to - 1LU); | |
} | |
static if (assignableIndex) | |
{ | |
pure nothrow @nogc @property @safe void back(dchar val) | |
{ | |
assert(&this, "null this"); | |
(*this.arr).opIndexAssign(val, this.to - 1LU); | |
} | |
} | |
auto inout pure nothrow @nogc @property @safe inout(SliceOverIndexed!(Grapheme)) save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
this.from++; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
this.to--; | |
} | |
const bool opEquals(T)(auto ref T arr) | |
{ | |
if (arr.length != length) | |
return false; | |
for (size_t i = 0; | |
i < length; i++) | |
{ | |
if (this[i] != arr[i]) | |
return false; | |
} | |
return true; | |
} | |
private | |
{ | |
alias Item = dchar; | |
ulong from; | |
ulong to; | |
Grapheme* arr; | |
} | |
} | |
opEquals!(SliceOverIndexed!(Grapheme)) | |
const pure nothrow @nogc @safe bool opEquals(SliceOverIndexed!(Grapheme) arr) | |
{ | |
assert(&this, "null this"); | |
if (arr.length() != this.length()) | |
return false; | |
{ | |
ulong i = 0LU; | |
for (; i < this.length(); i++) | |
{ | |
if (cast(uint)this.opIndex(i) != cast(uint)arr.opIndex(i)) | |
return false; | |
} | |
} | |
return true; | |
} | |
Flag!"allocateGC" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
Flag!"keepTerminator" | |
enum Flag : bool | |
{ | |
Flag no = cast(Flag)false, | |
Flag yes = cast(Flag)true, | |
} | |
CommonType!(int, ubyte) | |
alias CommonType = int; | |
CommonType!int | |
alias CommonType = int; | |
isFloatingPoint!int | |
enum bool isFloatingPoint = false; | |
Unqual!int | |
alias Unqual = int; | |
isIntegral!int | |
enum bool isIntegral = true; | |
IntegralTypeOf!int | |
alias IntegralTypeOf = int; | |
isAggregateType!int | |
enum bool isAggregateType = false; | |
OriginalType!int | |
alias OriginalType = int; | |
ModifyTypePreservingTQ!(Impl, int) | |
alias ModifyTypePreservingTQ = int; | |
Modifier!int | |
alias Impl = int; | |
TypeTuple!() | |
alias AliasSeq = (); | |
TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong) | |
alias AliasSeq = (byte, ubyte, short, ushort, int, uint, long, ulong); | |
staticIndexOf!(int, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = 4; | |
genericIndexOf!(int, byte, ubyte, short, ushort, int, uint, long, ulong) | |
OldAlias!int | |
alias OldAlias = int; | |
isAggregateType!byte | |
enum bool isAggregateType = false; | |
OldAlias!byte | |
alias OldAlias = byte; | |
isSame!(int, byte) | |
enum bool isSame = false; | |
expectType!int | |
expectType!byte | |
genericIndexOf!(int, ubyte, short, ushort, int, uint, long, ulong) | |
isAggregateType!ubyte | |
enum bool isAggregateType = false; | |
OldAlias!ubyte | |
alias OldAlias = ubyte; | |
isSame!(int, ubyte) | |
enum bool isSame = false; | |
expectType!ubyte | |
genericIndexOf!(int, short, ushort, int, uint, long, ulong) | |
isAggregateType!short | |
enum bool isAggregateType = false; | |
OldAlias!short | |
alias OldAlias = short; | |
isSame!(int, short) | |
enum bool isSame = false; | |
expectType!short | |
genericIndexOf!(int, ushort, int, uint, long, ulong) | |
isAggregateType!ushort | |
enum bool isAggregateType = false; | |
OldAlias!ushort | |
alias OldAlias = ushort; | |
isSame!(int, ushort) | |
enum bool isSame = false; | |
expectType!ushort | |
genericIndexOf!(int, int, uint, long, ulong) | |
isSame!(int, int) | |
enum bool isSame = true; | |
iota!(int, ubyte) | |
auto pure nothrow @nogc @safe Result iota(int begin, ubyte end) | |
{ | |
import std.conv : unsigned; | |
alias Value = int; | |
static struct Result | |
{ | |
private | |
{ | |
int current; | |
int pastLast; | |
} | |
pure nothrow @nogc @safe this(int current, int pastLast) | |
{ | |
if (current < pastLast) | |
{ | |
assert(cast(ulong)unsigned(pastLast - current) <= 18446744073709551615LU); | |
this.current = current; | |
this.pastLast = pastLast; | |
} | |
else | |
{ | |
this.current = (this.pastLast = current); | |
} | |
return this; | |
} | |
const pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this.current == this.pastLast; | |
} | |
inout pure nothrow @nogc @property @safe inout(int) front() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty()); | |
return this.current; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty()); | |
this.current += 1; | |
} | |
inout pure nothrow @nogc @property @safe inout(int) back() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty()); | |
return this.pastLast - 1; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty()); | |
this.pastLast -= 1; | |
} | |
auto pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
inout pure nothrow @nogc @safe inout(int) opIndex(ulong n) | |
{ | |
assert(&this, "null this"); | |
assert(n < this.length()); | |
return cast(inout(int))(cast(ulong)this.current + n); | |
} | |
inout pure nothrow @nogc @safe inout(Result) opSlice() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
inout pure nothrow @nogc @safe inout(Result) opSlice(ulong lower, ulong upper) | |
{ | |
assert(&this, "null this"); | |
assert(upper >= lower && upper <= this.length()); | |
return Result(0, 0).this(cast(int)(cast(ulong)this.current + lower), cast(int)(cast(ulong)this.pastLast - (this.length() - upper))); | |
} | |
const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.pastLast - this.current); | |
} | |
alias opDollar = const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)(this.pastLast - this.current); | |
} | |
; | |
} | |
return Result(0, 0).this(begin, cast(int)end); | |
} | |
Unqual!ubyte | |
alias Unqual = ubyte; | |
isSomeChar!int | |
enum bool isSomeChar = false; | |
TypeTuple!(char, wchar, dchar) | |
alias AliasSeq = (char, wchar, dchar); | |
staticIndexOf!(int, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(int, char, wchar, dchar) | |
isAggregateType!char | |
enum bool isAggregateType = false; | |
OldAlias!char | |
alias OldAlias = char; | |
isSame!(int, char) | |
enum bool isSame = false; | |
expectType!char | |
genericIndexOf!(int, wchar, dchar) | |
isAggregateType!wchar | |
enum bool isAggregateType = false; | |
OldAlias!wchar | |
alias OldAlias = wchar; | |
isSame!(int, wchar) | |
enum bool isSame = false; | |
expectType!wchar | |
genericIndexOf!(int, dchar) | |
isAggregateType!dchar | |
enum bool isAggregateType = false; | |
OldAlias!dchar | |
alias OldAlias = dchar; | |
isSame!(int, dchar) | |
enum bool isSame = false; | |
expectType!dchar | |
genericIndexOf!int | |
unsigned!int | |
auto pure nothrow @nogc @safe uint unsigned(int x) | |
{ | |
return cast(uint)x; | |
} | |
Unsigned!int | |
alias Unsigned = uint; | |
ModifyTypePreservingTQ!(Impl, int) | |
alias ModifyTypePreservingTQ = uint; | |
Modifier!int | |
alias Impl = uint; | |
isUnsigned!int | |
enum bool isUnsigned = false; | |
isSigned!int | |
enum bool isSigned = true; | |
Unqual!uint | |
alias Unqual = uint; | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
CommonType!ubyte | |
alias CommonType = ubyte; | |
only!ubyte | |
auto pure nothrow @nogc @safe OnlyResult!(ubyte, 1LU) only(ubyte _param_0) | |
{ | |
return OnlyResult(cast(ubyte)0u, true).this(_param_0); | |
} | |
OnlyResult!(ubyte, 1LU) | |
struct OnlyResult | |
{ | |
pure nothrow @nogc @property @safe ubyte front() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty(), "Attempting to fetch the front of an empty Only range"); | |
return this._value; | |
} | |
pure nothrow @nogc @property @safe ubyte back() | |
{ | |
assert(&this, "null this"); | |
assert(!this.empty(), "Attempting to fetch the back of an empty Only range"); | |
return this._value; | |
} | |
const pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
return this._empty; | |
} | |
const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)!this._empty; | |
} | |
auto pure nothrow @nogc @property @safe OnlyResult!(ubyte, 1LU) save() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
assert(!this._empty, "Attempting to popFront an empty Only range"); | |
this._empty = true; | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
assert(!this._empty, "Attempting to popBack an empty Only range"); | |
this._empty = true; | |
} | |
alias opDollar = const pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
return cast(ulong)!this._empty; | |
} | |
; | |
private this()(auto ref T value) | |
{ | |
this._value = value; | |
this._empty = false; | |
} | |
pure nothrow @nogc @safe ubyte opIndex(ulong i) | |
{ | |
assert(&this, "null this"); | |
assert(!this._empty && i == 0LU, "Attempting to fetch an out of bounds index from an Only range"); | |
return this._value; | |
} | |
pure nothrow @nogc @safe OnlyResult!(ubyte, 1LU) opSlice() | |
{ | |
assert(&this, "null this"); | |
return this; | |
} | |
pure nothrow @nogc @safe OnlyResult!(ubyte, 1LU) opSlice(ulong from, ulong to) | |
{ | |
assert(&this, "null this"); | |
assert(from <= to, "Attempting to slice an Only range with a larger first argument than the second."); | |
assert(to <= this.length(), "Attempting to slice using an out of bounds index on an Only range"); | |
OnlyResult!(ubyte, 1LU) copy = this; | |
copy._empty = this._empty || from == to; | |
return copy; | |
} | |
private ubyte _value; | |
private bool _empty = true; | |
} | |
__ctor!() | |
pure nothrow @nogc @safe this(ref ubyte value) | |
{ | |
this._value = value; | |
this._empty = false; | |
return this; | |
} | |
RTInfo!(OnlyResult!(ubyte, 1LU)) | |
enum typeof(null) RTInfo = null; | |
staticMap!(Unqual, Result, OnlyResult!(ubyte, 1LU)) | |
alias staticMap = (Result, OnlyResult!(ubyte, 1LU)); | |
staticMap!(Unqual, Result) | |
alias staticMap = (Result); | |
F!(Result) | |
alias Unqual = Result; | |
AliasSeq!(Result) | |
alias AliasSeq = (Result); | |
staticMap!(Unqual, OnlyResult!(ubyte, 1LU)) | |
alias staticMap = (OnlyResult!(ubyte, 1LU)); | |
F!(OnlyResult!(ubyte, 1LU)) | |
alias Unqual = OnlyResult!(ubyte, 1LU); | |
AliasSeq!(OnlyResult!(ubyte, 1LU)) | |
alias AliasSeq = (OnlyResult!(ubyte, 1LU)); | |
AliasSeq!(Result, OnlyResult!(ubyte, 1LU)) | |
alias AliasSeq = (Result, OnlyResult!(ubyte, 1LU)); | |
allSatisfy!(isInputRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isInputRange, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool isInputRange = true; | |
allSatisfy!(isInputRange, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool isInputRange = true; | |
staticMap!(ElementType, Result, OnlyResult!(ubyte, 1LU)) | |
alias staticMap = (int, ubyte); | |
staticMap!(ElementType, Result) | |
alias staticMap = (int); | |
F!(Result) | |
alias ElementType = int; | |
AliasSeq!int | |
alias AliasSeq = (int); | |
staticMap!(ElementType, OnlyResult!(ubyte, 1LU)) | |
alias staticMap = (ubyte); | |
F!(OnlyResult!(ubyte, 1LU)) | |
alias ElementType = ubyte; | |
AliasSeq!ubyte | |
alias AliasSeq = (ubyte); | |
AliasSeq!(int, ubyte) | |
alias AliasSeq = (int, ubyte); | |
chain!(Result, OnlyResult!(ubyte, 1LU)) | |
auto pure nothrow @nogc @safe Result chain(Result _param_0, OnlyResult!(ubyte, 1LU) _param_1) | |
{ | |
static struct Result | |
{ | |
private | |
{ | |
alias R = (Result, OnlyResult!(ubyte, 1LU)); | |
alias RvalueElementType = int; | |
private enum sameET(A) = is(.ElementType!A | |
== RvalueElementType); | |
enum bool allSameType = false; | |
static if (allSameType) | |
{ | |
alias ElementType = ref RvalueElementType; | |
} | |
else | |
{ | |
alias ElementType = int; | |
} | |
static if (false && allSatisfy!(hasLvalueElements, R) | |
) | |
{ | |
static ref RvalueElementType fixRef(ref RvalueElementType val) | |
{ | |
return val; | |
} | |
} | |
else | |
{ | |
static pure nothrow @nogc @safe int fixRef(int val) | |
{ | |
return val; | |
} | |
} | |
(Result, OnlyResult!(ubyte, 1LU)) source; | |
public | |
{ | |
pure nothrow @nogc @safe this(Result _param_0, OnlyResult!(ubyte, 1LU) _param_1) | |
{ | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
Result v = _param_0; | |
this.__source_field_0 = v; | |
} | |
{ | |
enum ulong i = 1LU; | |
OnlyResult!(ubyte, 1LU) v = _param_1; | |
this.__source_field_1 = v; | |
} | |
} | |
return this; | |
} | |
import std.meta : anySatisfy; | |
static if (anySatisfy!(isInfinite, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool anySatisfy = false; | |
) | |
{ | |
enum bool empty = false; | |
} | |
else | |
{ | |
pure nothrow @nogc @property @safe bool empty() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (!this.__source_field_0.empty()) | |
return false; | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (!this.__source_field_1.empty()) | |
return false; | |
} | |
} | |
return true; | |
} | |
} | |
static if (allSatisfy!(isForwardRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
auto pure nothrow @nogc @property @safe Result save() | |
{ | |
assert(&this, "null this"); | |
Result result = this; | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
result.__source_field_0 = result.__source_field_0.save(); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
result.__source_field_1 = result.__source_field_1.save(); | |
} | |
} | |
return result; | |
} | |
} | |
pure nothrow @nogc @safe void popFront() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
this.__source_field_0.popFront(); | |
return ; | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
this.__source_field_1.popFront(); | |
return ; | |
} | |
} | |
} | |
auto pure nothrow @nogc @property @safe int front() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
return fixRef(this.__source_field_0.front()); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
return fixRef(cast(int)this.__source_field_1.front()); | |
} | |
} | |
assert(false); | |
} | |
static if (false && allSatisfy!(hasAssignableElements, R) | |
) | |
{ | |
@property void front(RvalueElementType v) | |
{ | |
foreach (i, Unused; R) | |
{ | |
if (source[i].empty) | |
continue; | |
source[i].front = v; | |
return ; | |
} | |
assert(false); | |
} | |
} | |
static if (allSatisfy!(hasMobileElements, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
pure nothrow @nogc @safe int moveFront() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
return moveFront(this.__source_field_0); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
return cast(int)moveFront(this.__source_field_1); | |
} | |
} | |
assert(false); | |
} | |
} | |
static if (allSatisfy!(isBidirectionalRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
auto pure nothrow @nogc @property @safe int back() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
return fixRef(cast(int)this.__source_field_1.back()); | |
} | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
return fixRef(this.__source_field_0.back()); | |
} | |
} | |
assert(false); | |
} | |
pure nothrow @nogc @safe void popBack() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
this.__source_field_1.popBack(); | |
return ; | |
} | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
this.__source_field_0.popBack(); | |
return ; | |
} | |
} | |
} | |
static if (allSatisfy!(hasMobileElements, Result, OnlyResult!(ubyte, 1LU)) | |
) | |
{ | |
pure nothrow @nogc @safe int moveBack() | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
if (this.__source_field_1.empty()) | |
continue; | |
return cast(int)moveBack(this.__source_field_1); | |
} | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
if (this.__source_field_0.empty()) | |
continue; | |
return moveBack(this.__source_field_0); | |
} | |
} | |
assert(false); | |
} | |
} | |
static if (false && allSatisfy!(hasAssignableElements, R) | |
) | |
{ | |
@property void back(RvalueElementType v) | |
{ | |
foreach_reverse (i, Unused; R) | |
{ | |
if (source[i].empty) | |
continue; | |
source[i].back = v; | |
return ; | |
} | |
assert(false); | |
} | |
} | |
} | |
static if (allSatisfy!(hasLength, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
ulong result = 0LU; | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
result += this.__source_field_0.length(); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
result += this.__source_field_1.length(); | |
} | |
} | |
return result; | |
} | |
alias opDollar = pure nothrow @nogc @property @safe ulong length() | |
{ | |
assert(&this, "null this"); | |
ulong result = 0LU; | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
result += this.__source_field_0.length(); | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
result += this.__source_field_1.length(); | |
} | |
} | |
return result; | |
} | |
; | |
} | |
static if (allSatisfy!(isRandomAccessRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
) | |
{ | |
auto pure nothrow @nogc @safe int opIndex(ulong index) | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Range = Result; | |
immutable immutable(ulong) length = this.__source_field_0.length(); | |
if (index < length) | |
return fixRef(this.__source_field_0.opIndex(index)); | |
index -= length; | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Range = OnlyResult!(ubyte, 1LU); | |
immutable immutable(ulong) length = this.__source_field_1.length(); | |
if (index < length) | |
return fixRef(cast(int)this.__source_field_1.opIndex(index)); | |
index -= length; | |
} | |
} | |
assert(false); | |
} | |
static if (allSatisfy!(hasMobileElements, Result, OnlyResult!(ubyte, 1LU)) | |
) | |
{ | |
pure nothrow @nogc @safe int moveAt(ulong index) | |
{ | |
assert(&this, "null this"); | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Range = Result; | |
immutable immutable(ulong) length = this.__source_field_0.length(); | |
if (index < length) | |
return moveAt(this.__source_field_0, index); | |
index -= length; | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Range = OnlyResult!(ubyte, 1LU); | |
immutable immutable(ulong) length = this.__source_field_1.length(); | |
if (index < length) | |
return cast(int)moveAt(this.__source_field_1, index); | |
index -= length; | |
} | |
} | |
assert(false); | |
} | |
} | |
static if (false && allSatisfy!(hasAssignableElements, R) | |
) | |
{ | |
void opIndexAssign(ElementType v, size_t index) | |
{ | |
foreach (i, Range; R) | |
{ | |
static if (isInfinite!Range | |
) | |
{ | |
source[i][index] = v; | |
} | |
else | |
{ | |
immutable length = source[i].length; | |
if (index < length) | |
{ | |
source[i][index] = v; | |
return ; | |
} | |
index -= length; | |
} | |
} | |
assert(false); | |
} | |
} | |
} | |
static if (true && true) | |
{ | |
auto pure nothrow @nogc @safe Result opSlice(ulong begin, ulong end) | |
{ | |
assert(&this, "null this"); | |
Result result = this; | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
immutable immutable(ulong) len = result.__source_field_0.length(); | |
if (len < begin) | |
{ | |
result.__source_field_0 = result.__source_field_0.opSlice(len, len); | |
begin -= len; | |
} | |
else | |
{ | |
result.__source_field_0 = result.__source_field_0.opSlice(begin, len); | |
break; | |
} | |
} | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
immutable immutable(ulong) len = result.__source_field_1.length(); | |
if (len < begin) | |
{ | |
result.__source_field_1 = result.__source_field_1.opSlice(len, len); | |
begin -= len; | |
} | |
else | |
{ | |
result.__source_field_1 = result.__source_field_1.opSlice(begin, len); | |
break; | |
} | |
} | |
} | |
ulong cut = this.length(); | |
cut = cut <= end ? 0LU : cut - end; | |
unrolled { | |
{ | |
enum ulong i = 1LU; | |
alias Unused = OnlyResult!(ubyte, 1LU); | |
immutable immutable(ulong) len = result.__source_field_1.length(); | |
if (cut > len) | |
{ | |
result.__source_field_1 = result.__source_field_1.opSlice(0LU, 0LU); | |
cut -= len; | |
} | |
else | |
{ | |
result.__source_field_1 = result.__source_field_1.opSlice(0LU, len - cut); | |
break; | |
} | |
} | |
{ | |
enum ulong i = 0LU; | |
alias Unused = Result; | |
immutable immutable(ulong) len = result.__source_field_0.length(); | |
if (cut > len) | |
{ | |
result.__source_field_0 = result.__source_field_0.opSlice(0LU, 0LU); | |
cut -= len; | |
} | |
else | |
{ | |
result.__source_field_0 = result.__source_field_0.opSlice(0LU, len - cut); | |
break; | |
} | |
} | |
} | |
return result; | |
} | |
} | |
} | |
} | |
Result __source_field_0; | |
OnlyResult!(ubyte, 1LU) __source_field_1; | |
} | |
return Result(Result(0, 0), OnlyResult(cast(ubyte)0u, true)).this(_param_0, _param_1); | |
} | |
allSatisfy!(sameET, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = false; | |
allSatisfy!(sameET, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool sameET = true; | |
allSatisfy!(sameET, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = false; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool sameET = false; | |
anySatisfy!(isInfinite, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool anySatisfy = false; | |
anySatisfy!(isInfinite, Result) | |
enum bool anySatisfy = false; | |
F!(Result) | |
enum bool isInfinite = false; | |
anySatisfy!(isInfinite, OnlyResult!(ubyte, 1LU)) | |
enum bool anySatisfy = false; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool isInfinite = false; | |
allSatisfy!(isForwardRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isForwardRange, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool isForwardRange = true; | |
allSatisfy!(isForwardRange, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool isForwardRange = true; | |
allSatisfy!(hasMobileElements, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasMobileElements, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool hasMobileElements = true; | |
moveFront!(Result) | |
pure nothrow @nogc @safe int moveFront(Result r) | |
{ | |
return r.front(); | |
} | |
hasElaborateCopyConstructor!int | |
enum bool hasElaborateCopyConstructor = false; | |
isStaticArray!int | |
enum bool isStaticArray = false; | |
isBidirectionalRange!(Result) | |
enum bool isBidirectionalRange = true; | |
moveBack!(Result) | |
pure nothrow @nogc @safe int moveBack(Result r) | |
{ | |
return r.back(); | |
} | |
isRandomAccessRange!(Result) | |
enum bool isRandomAccessRange = true; | |
isNarrowString!(Result) | |
enum bool isNarrowString = false; | |
isAggregateType!(Result) | |
enum bool isAggregateType = true; | |
isStaticArray!(Result) | |
enum bool isStaticArray = false; | |
hasLength!(Result) | |
enum bool hasLength = true; | |
moveAt!(Result) | |
pure nothrow @nogc @safe int moveAt(Result r, ulong i) | |
{ | |
return r.opIndex(i); | |
} | |
allSatisfy!(hasMobileElements, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool hasMobileElements = true; | |
moveFront!(OnlyResult!(ubyte, 1LU)) | |
pure nothrow @nogc @safe ubyte moveFront(OnlyResult!(ubyte, 1LU) r) | |
{ | |
return r.front(); | |
} | |
hasElaborateCopyConstructor!ubyte | |
enum bool hasElaborateCopyConstructor = false; | |
isStaticArray!ubyte | |
enum bool isStaticArray = false; | |
isBidirectionalRange!(OnlyResult!(ubyte, 1LU)) | |
enum bool isBidirectionalRange = true; | |
moveBack!(OnlyResult!(ubyte, 1LU)) | |
pure nothrow @nogc @safe ubyte moveBack(OnlyResult!(ubyte, 1LU) r) | |
{ | |
return r.back(); | |
} | |
isRandomAccessRange!(OnlyResult!(ubyte, 1LU)) | |
enum bool isRandomAccessRange = true; | |
isNarrowString!(OnlyResult!(ubyte, 1LU)) | |
enum bool isNarrowString = false; | |
isAggregateType!(OnlyResult!(ubyte, 1LU)) | |
enum bool isAggregateType = true; | |
isStaticArray!(OnlyResult!(ubyte, 1LU)) | |
enum bool isStaticArray = false; | |
hasLength!(OnlyResult!(ubyte, 1LU)) | |
enum bool hasLength = true; | |
moveAt!(OnlyResult!(ubyte, 1LU)) | |
pure nothrow @nogc @safe ubyte moveAt(OnlyResult!(ubyte, 1LU) r, ulong i) | |
{ | |
return r.opIndex(i); | |
} | |
allSatisfy!(isBidirectionalRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isBidirectionalRange, Result) | |
enum bool allSatisfy = true; | |
allSatisfy!(isBidirectionalRange, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasLength, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasLength, Result) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasLength, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isRandomAccessRange, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(isRandomAccessRange, Result) | |
enum bool allSatisfy = true; | |
allSatisfy!(isRandomAccessRange, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasSlicing, Result, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
allSatisfy!(hasSlicing, Result) | |
enum bool allSatisfy = true; | |
F!(Result) | |
enum bool hasSlicing = true; | |
allSatisfy!(hasSlicing, OnlyResult!(ubyte, 1LU)) | |
enum bool allSatisfy = true; | |
F!(OnlyResult!(ubyte, 1LU)) | |
enum bool hasSlicing = true; | |
RTInfo!(Result) | |
enum typeof(null) RTInfo = null; | |
isSomeChar!char | |
enum bool isSomeChar = true; | |
CharTypeOf!char | |
alias CharTypeOf = char; | |
OriginalType!char | |
alias OriginalType = char; | |
ModifyTypePreservingTQ!(Impl, char) | |
alias ModifyTypePreservingTQ = char; | |
Modifier!char | |
alias Impl = char; | |
Unqual!char | |
alias Unqual = char; | |
staticIndexOf!(char, char, wchar, dchar) | |
enum int staticIndexOf = 0; | |
genericIndexOf!(char, char, wchar, dchar) | |
isSame!(char, char) | |
enum bool isSame = true; | |
format!(char, ubyte) | |
pure @safe string format(const(char[]) fmt, ubyte _param_1) | |
{ | |
import std.format : formattedWrite, FormatException; | |
import std.array : appender; | |
Appender!string w = appender(); | |
uint n = formattedWrite(w, fmt, _param_1); | |
import std.conv : text; | |
import std.exception : enforce; | |
enforce(cast(ulong)n == 1LU, delegate Throwable() => new FormatException(text("Orphan format arguments: args[", n, "..", 1LU, "]"), "/usr/include/dmd/phobos/std/format.d", 5531LU, null)); | |
return w.data(); | |
} | |
isDynamicArray!string | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!string | |
alias DynamicArrayTypeOf = string; | |
isAggregateType!string | |
enum bool isAggregateType = false; | |
OriginalType!string | |
alias OriginalType = string; | |
ModifyTypePreservingTQ!(Impl, string) | |
alias ModifyTypePreservingTQ = string; | |
Modifier!string | |
alias Impl = string; | |
Unqual!string | |
alias Unqual = string; | |
appender!string | |
pure nothrow @safe Appender!string appender() | |
{ | |
return Appender(null).this(null); | |
} | |
Appender!string | |
struct Appender | |
{ | |
import core.memory : GC; | |
private alias T = immutable(char); | |
private struct Data | |
{ | |
ulong capacity; | |
char[] arr; | |
bool canExtend = false; | |
} | |
private Data* _data; | |
pure nothrow @trusted this(string arr) | |
{ | |
this._data = new Data(0LU, null, false); | |
(*this._data).arr = cast(char[])arr; | |
if (__ctfe) | |
return this; | |
(*this._data).capacity = arr.length; | |
return this; | |
} | |
pure nothrow @safe void reserve(ulong newCapacity) | |
{ | |
assert(&this, "null this"); | |
if (this._data) | |
{ | |
if (newCapacity > (*this._data).capacity) | |
this.ensureAddable(newCapacity - (*this._data).arr.length); | |
} | |
else | |
{ | |
this.ensureAddable(newCapacity); | |
} | |
} | |
const pure nothrow @nogc @property @safe ulong capacity() | |
{ | |
assert(&this, "null this"); | |
return this._data ? (*this._data).capacity : 0LU; | |
} | |
inout pure nothrow @nogc @property @trusted string data() | |
{ | |
assert(&this, "null this"); | |
return this._data ? cast(string)(*this._data).arr : null; | |
} | |
private pure nothrow @trusted void ensureAddable(ulong nelems) | |
{ | |
if (!this._data) | |
this._data = new Data(0LU, null, false); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
immutable immutable(ulong) reqlen = len + nelems; | |
if ((*this._data).capacity >= reqlen) | |
return ; | |
if (__ctfe) | |
{ | |
(*this._data).arr.length = reqlen; | |
(*this._data).arr = (*this._data).arr[0..len]; | |
(*this._data).capacity = reqlen; | |
} | |
else | |
{ | |
ulong newlen = appenderNewCapacity((*this._data).capacity, reqlen); | |
if ((*this._data).canExtend) | |
{ | |
immutable immutable(ulong) u = extend(cast(void*)cast(char*)(*this._data).arr, nelems * 1LU, (newlen - len) * 1LU, null); | |
if (u) | |
{ | |
(*this._data).capacity = u / 1LU; | |
return ; | |
} | |
} | |
import core.checkedint : mulu; | |
bool overflow = false; | |
const const(ulong) nbytes = mulu(newlen, 1LU, overflow); | |
if (overflow) | |
assert(0); | |
BlkInfo_ bi = qalloc(nbytes, 2u, null); | |
(*this._data).capacity = bi.size / 1LU; | |
import core.stdc.string : memcpy; | |
if (len) | |
memcpy(bi.base, cast(const(void*))cast(char*)(*this._data).arr, len * 1LU); | |
(*this._data).arr = (cast(char*)bi.base)[0..len]; | |
(*this._data).canExtend = true; | |
} | |
} | |
private enum bool canPutItem(U) = isImplicitlyConvertible!(U, T) | |
|| isSomeChar!T | |
&& isSomeChar!U | |
; | |
private enum bool canPutConstRange(Range) = isInputRange!(Unqual!Range | |
) | |
&& !isInputRange!Range | |
; | |
private enum bool canPutRange(Range) = isInputRange!Range | |
&& is(typeof(Appender.init.put(Range.init.front))); | |
void put(U)(U item) if (canPutItem!U | |
) | |
{ | |
static if (isSomeChar!T | |
&& isSomeChar!U | |
&& T.sizeof < U.sizeof) | |
{ | |
import std.utf : encode; | |
Unqual!T | |
[T.sizeof == 1 ? 4 : 2] encoded; | |
auto len = encode(encoded, item); | |
put(encoded[0..len]); | |
} | |
else | |
{ | |
import std.conv : emplaceRef; | |
ensureAddable(1); | |
immutable len = _data.arr.length; | |
auto bigData = () => _data.arr.ptr[0..len + 1](); | |
emplaceRef!(Unqual!T | |
) | |
(bigData[len], cast(Unqual!T | |
)item); | |
_data.arr = bigData; | |
} | |
} | |
void put(Range)(Range items) if (canPutConstRange!Range | |
) | |
{ | |
alias p = put!(Unqual!Range | |
) | |
; | |
p(items); | |
} | |
void put(Range)(Range items) if (canPutRange!Range | |
) | |
{ | |
static if (!(isSomeChar!T | |
&& isSomeChar!(ElementType!Range | |
) | |
&& !is(immutable(Range) == immutable(T[]))) && is(typeof(items.length) == size_t)) | |
{ | |
static if (!isSomeChar!T | |
) | |
{ | |
if (items.length == 1) | |
{ | |
put(items.front); | |
return ; | |
} | |
} | |
auto @trusted bigDataFun(size_t extra) | |
{ | |
ensureAddable(extra); | |
return _data.arr.ptr[0.._data.arr.length + extra]; | |
} | |
auto bigData = bigDataFun(items.length); | |
immutable len = _data.arr.length; | |
immutable newlen = bigData.length; | |
alias UT = Unqual!T | |
; | |
static if (is(typeof(_data.arr[] = items[])) && !hasElaborateAssign!UT | |
&& isAssignable!(UT, ElementEncodingType!Range | |
) | |
) | |
{ | |
bigData[len..newlen] = items[]; | |
} | |
else | |
{ | |
import std.conv : emplaceRef; | |
foreach (ref it; bigData[len..newlen]) | |
{ | |
emplaceRef!T | |
(it, items.front); | |
items.popFront(); | |
} | |
} | |
_data.arr = bigData; | |
} | |
else | |
{ | |
for (; !items.empty; items.popFront()) | |
{ | |
{ | |
put(items.front); | |
} | |
} | |
} | |
} | |
void opOpAssign(string op : "~", U)(U rhs) if (__traits(compiles, put(rhs))) | |
{ | |
put(rhs); | |
} | |
static if (isMutable!(immutable(char)) | |
enum bool isMutable = false; | |
) | |
{ | |
pure nothrow @trusted void clear() | |
{ | |
if (_data) | |
{ | |
_data.arr = _data.arr.ptr[0..0]; | |
} | |
} | |
pure @trusted void shrinkTo(size_t newlength) | |
{ | |
import std.exception : enforce; | |
if (_data) | |
{ | |
enforce(newlength <= _data.arr.length, "Attempting to shrink Appender with newlength > length"); | |
_data.arr = _data.arr.ptr[0..newlength]; | |
} | |
else | |
enforce(newlength == 0, "Attempting to shrink empty Appender with non-zero newlength"); | |
} | |
} | |
void toString(Writer)(scope Writer w) | |
{ | |
import std.format : formattedWrite; | |
w.formattedWrite((typeof(this)).stringof ~ "(%s)", data); | |
} | |
} | |
ElementEncodingType!string | |
alias ElementEncodingType = immutable(char); | |
StringTypeOf!string | |
alias StringTypeOf = string; | |
Unqual!(immutable(char)) | |
alias Unqual = char; | |
isMutable!(immutable(char)) | |
enum bool isMutable = false; | |
static __gshared TypeInfo_Struct _D53TypeInfo_S3std5array17__T8AppenderTAyaZ8Appender4Data6__initZ; | |
formattedWrite!(Appender!string, char, ubyte) | |
pure @safe uint formattedWrite(Appender!string w, const(char[]) fmt, ubyte _param_2) | |
{ | |
import std.conv : text, to; | |
alias FPfmt = void function(Appender!string, scope const(void)*, ref const(FormatSpec!char)) pure nothrow @safe; | |
FormatSpec!char spec = spec = FormatSpec , spec.this(fmt); | |
void function(Appender!string, scope const(void)*, ref const(FormatSpec!char)) pure nothrow @safe[1] funs = null; | |
scope const(void)*[1] argsAddresses = null; | |
if (!__ctfe) | |
{ | |
unrolled { | |
{ | |
enum ulong i = 0LU; | |
alias Arg = ubyte; | |
funs[0] = (*function () => & formatGeneric)(); | |
argsAddresses[0] = (*function (return ref ubyte arg) => cast(const(void*))&arg)(_param_2); | |
if (0) | |
formatValue(w, _param_2, spec); | |
} | |
} | |
} | |
uint currentArg = 0u; | |
for (; spec.writeUpToNextSpec(w);) | |
{ | |
{ | |
if (cast(ulong)currentArg == 1LU && !spec.indexStart) | |
{ | |
enforceEx(fmt.length == 0LU, delegate string() => text("Orphan format specifier: %", spec.spec), "/usr/include/dmd/phobos/std/format.d", 477LU); | |
break; | |
} | |
if (spec.width == 2147483647) | |
{ | |
int width = to(getNthInt(currentArg, _param_2)); | |
if (width < 0) | |
{ | |
spec.flDash(true); | |
width = -width; | |
} | |
spec.width = width; | |
currentArg += 1u; | |
} | |
else if (spec.width < 0) | |
{ | |
uint index = cast(uint)-spec.width; | |
assert(index > 0u); | |
int width = to(getNthInt(index - 1u, _param_2)); | |
if (currentArg < index) | |
currentArg = index; | |
if (width < 0) | |
{ | |
spec.flDash(true); | |
width = -width; | |
} | |
spec.width = width; | |
} | |
if (spec.precision == 2147483647) | |
{ | |
int precision = to(getNthInt(currentArg, _param_2)); | |
if (precision >= 0) | |
spec.precision = precision; | |
else | |
spec.precision = 2147483646; | |
currentArg += 1u; | |
} | |
else if (spec.precision < 0) | |
{ | |
uint index = cast(uint)-spec.precision; | |
assert(index > 0u); | |
int precision = to(getNthInt(index - 1u, _param_2)); | |
if (currentArg < index) | |
currentArg = index; | |
if (precision >= 0) | |
spec.precision = precision; | |
else | |
spec.precision = 2147483646; | |
} | |
if (cast(int)spec.indexStart > 0) | |
{ | |
{ | |
int __key2396 = cast(int)spec.indexStart - 1; | |
int __limit2397 = cast(int)spec.indexEnd; | |
for (; __key2396 < __limit2397; __key2396 += 1) | |
{ | |
int i = __key2396; | |
if (1LU <= cast(ulong)i) | |
break; | |
if (__ctfe) | |
formatNth(w, spec, cast(ulong)i, _param_2); | |
else | |
(*funs[cast(ulong)i])(w, argsAddresses[cast(ulong)i], spec); | |
} | |
} | |
if (currentArg < cast(uint)cast(int)spec.indexEnd) | |
currentArg = cast(uint)spec.indexEnd; | |
} | |
else | |
{ | |
if (__ctfe) | |
formatNth(w, spec, cast(ulong)currentArg, _param_2); | |
else | |
(*funs[cast(ulong)currentArg])(w, argsAddresses[cast(ulong)currentArg], spec); | |
currentArg += 1u; | |
} | |
} | |
} | |
return currentArg; | |
} | |
FormatSpec!char | |
struct FormatSpec | |
{ | |
import std.ascii : isDigit; | |
import std.algorithm.searching : startsWith; | |
import std.conv : parse, text, to; | |
int width = 0; | |
int precision = 2147483646; | |
enum int DYNAMIC = 2147483647; | |
enum int UNSPECIFIED = 2147483646; | |
char spec = 's'; | |
ubyte indexStart; | |
ubyte indexEnd; | |
version (StdDdoc) | |
{ | |
bool flDash; | |
bool flZero; | |
bool flSpace; | |
bool flPlus; | |
bool flHash; | |
ubyte allFlags; | |
} | |
else | |
{ | |
union | |
{ | |
import std.bitmanip : bitfields; | |
mixin(bitfields!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
string bitfields = "private ubyte _flDash_flZero_flSpace_flPlus_flHash_;@property bool flDash() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 1U) != 0;}\x0a@property void flDash(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 1U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))1U;}\x0a@property bool flZero() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 2U) != 0;}\x0a@property void flZero(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 2U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))2U;}\x0a@property bool flSpace() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 4U) != 0;}\x0a@property void flSpace(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 4U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))4U;}\x0a@property bool flPlus() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 8U) != 0;}\x0a@property void flPlus(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 8U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))8U;}\x0a@property bool flHash() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 16U) != 0;}\x0a@property void flHash(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 16U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))16U;}\x0a"); | |
ubyte allFlags; | |
} | |
} | |
const(char)[] nested; | |
const(char)[] sep; | |
const(char)[] trailing; | |
enum string seqBefore = "["; | |
enum string seqAfter = "]"; | |
enum string keySeparator = ":"; | |
enum string seqSeparator = ", "; | |
pure nothrow @nogc @safe this(const(char[]) fmt) | |
{ | |
this.trailing = fmt; | |
return this; | |
} | |
bool writeUpToNextSpec(OutputRange)(OutputRange writer) | |
{ | |
if (trailing.empty) | |
return false; | |
for (size_t i = 0; | |
i < trailing.length; ++i) | |
{ | |
{ | |
if (trailing[i] != '%') | |
continue; | |
put(writer, trailing[0..i]); | |
trailing = trailing[i..__dollar]; | |
enforceFmt(trailing.length >= 2, "Unterminated format specifier: \"%\""); | |
trailing = trailing[1..__dollar]; | |
if (trailing[0] != '%') | |
{ | |
fillUp(); | |
return true; | |
} | |
i = 0; | |
} | |
} | |
put(writer, trailing); | |
trailing = null; | |
return false; | |
} | |
unittest | |
{ | |
import std.array; | |
Appender!(char[]) w = appender(); | |
FormatSpec!char f = f = FormatSpec , f.this("abc%sdef%sghi"); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "abc", w.data()); | |
assert(f.trailing == "def%sghi", text(f.trailing)); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "abcdef", w.data()); | |
assert(f.trailing == "ghi"); | |
f = FormatSpec(0, 2147483646, 's', cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, , null, null, null).this("ab%%cd%%ef%sg%%h%sij"); | |
w.clear(); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "ab%cd%ef" && f.trailing == "g%%h%sij", w.data()); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "ab%cd%efg%h" && f.trailing == "ij"); | |
f = FormatSpec(0, 2147483646, 's', cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, , null, null, null).this("%%%s"); | |
w.clear(); | |
f.writeUpToNextSpec(w); | |
assert(w.data() == "%" && f.trailing == ""); | |
f = FormatSpec(0, 2147483646, 's', cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, , null, null, null).this("%%%%%s%%"); | |
w.clear(); | |
for (; f.writeUpToNextSpec(w);) | |
{ | |
continue; | |
} | |
assert(w.data() == "%%%"); | |
f = FormatSpec(0, 2147483646, 's', cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, , null, null, null).this("a%%b%%c%"); | |
w.clear(); | |
assertThrown(delegate bool() => f.writeUpToNextSpec(w), null, "/usr/include/dmd/phobos/std/format.d", 1151LU); | |
assert(w.data() == "a%b%c" && f.trailing == "%"); | |
} | |
private pure @safe void fillUp() | |
{ | |
if (__ctfe) | |
{ | |
this.flDash(false); | |
this.flZero(false); | |
this.flSpace(false); | |
this.flPlus(false); | |
this.flHash(false); | |
} | |
else | |
{ | |
this.allFlags = cast(ubyte)0u; | |
} | |
this.width = 0; | |
this.precision = 2147483646; | |
this.nested = null; | |
{ | |
ulong i = 0LU; | |
for (; i < this.trailing.length;) | |
{ | |
{ | |
switch (cast(int)this.trailing[i]) | |
{ | |
case 40: | |
{ | |
ulong j = i + 1LU; | |
{ | |
uint innerParens = 0u; | |
for (;;) | |
{ | |
{ | |
enforceEx(j + 1LU < this.trailing.length, delegate string() => text("Incorrect format specifier: %", this.trailing[i..__dollar]), "/usr/include/dmd/phobos/std/format.d", 1185LU); | |
if (cast(int)this.trailing[j++] != 37) | |
{ | |
continue; | |
} | |
if (cast(int)this.trailing[j] == 45) | |
{ | |
j += 1LU; | |
enforceEx(j < this.trailing.length, delegate string() => text("Incorrect format specifier: %", this.trailing[i..__dollar]), "/usr/include/dmd/phobos/std/format.d", 1195LU); | |
} | |
if (cast(int)this.trailing[j] == 41) | |
{ | |
if (innerParens-- == 0u) | |
break; | |
} | |
else if (cast(int)this.trailing[j] == 124) | |
{ | |
if (innerParens == 0u) | |
break; | |
} | |
else if (cast(int)this.trailing[j] == 40) | |
{ | |
innerParens += 1u; | |
} | |
} | |
} | |
} | |
if (cast(int)this.trailing[j] == 124) | |
{ | |
ulong k = j; | |
{ | |
j += 1LU; | |
for (;;) | |
{ | |
{ | |
if (cast(int)this.trailing[j++] != 37) | |
continue; | |
if (cast(int)this.trailing[j] == 37) | |
j += 1LU; | |
else if (cast(int)this.trailing[j] == 41) | |
break; | |
else | |
throw new Exception(text("Incorrect format specifier: %", this.trailing[j..__dollar]), "/usr/include/dmd/phobos/std/format.d", 1223LU, null); | |
} | |
} | |
} | |
this.nested = this.trailing[i + 1LU..k - 1LU]; | |
this.sep = this.trailing[k + 1LU..j - 1LU]; | |
} | |
else | |
{ | |
this.nested = this.trailing[i + 1LU..j - 1LU]; | |
this.sep = null; | |
} | |
this.spec = '('; | |
this.trailing = this.trailing[j + 1LU..__dollar]; | |
return ; | |
} | |
case 45: | |
{ | |
this.flDash(true); | |
i += 1LU; | |
break; | |
} | |
case 43: | |
{ | |
this.flPlus(true); | |
i += 1LU; | |
break; | |
} | |
case 35: | |
{ | |
this.flHash(true); | |
i += 1LU; | |
break; | |
} | |
case 48: | |
{ | |
this.flZero(true); | |
i += 1LU; | |
break; | |
} | |
case 32: | |
{ | |
this.flSpace(true); | |
i += 1LU; | |
break; | |
} | |
case 42: | |
{ | |
if (isDigit(cast(dchar)this.trailing[i += 1LU])) | |
{ | |
this.trailing = this.trailing[1..__dollar]; | |
this.width = -parse(this.trailing); | |
i = 0LU; | |
enforceEx(cast(int)this.trailing[i++] == 36, delegate string() => "$ expected", "/usr/include/dmd/phobos/std/format.d", 1253LU); | |
} | |
else | |
{ | |
this.width = 2147483647; | |
} | |
break; | |
} | |
case 49: | |
; | |
case 50: | |
; | |
case 51: | |
; | |
case 52: | |
; | |
case 53: | |
; | |
case 54: | |
; | |
case 55: | |
; | |
case 56: | |
; | |
case 57: | |
{ | |
const(char)[] tmp = this.trailing[i..__dollar]; | |
const const(uint) widthOrArgIndex = parse(tmp); | |
enforceEx(tmp.length, delegate string() => text("Incorrect format specifier %", this.trailing[i..__dollar]), "/usr/include/dmd/phobos/std/format.d", 1265LU); | |
i = cast(ulong)arrayPtrDiff(tmp, this.trailing); | |
if (startsWith(tmp, '$')) | |
{ | |
this.indexEnd = (this.indexStart = to(widthOrArgIndex)); | |
i += 1LU; | |
} | |
else if (startsWith(tmp, ':')) | |
{ | |
this.indexStart = to(widthOrArgIndex); | |
tmp = tmp[1..__dollar]; | |
if (startsWith(tmp, '$')) | |
{ | |
this.indexEnd = cast(ubyte)255u; | |
} | |
else | |
{ | |
this.indexEnd = parse(tmp); | |
} | |
i = cast(ulong)arrayPtrDiff(tmp, this.trailing); | |
enforceEx(cast(int)this.trailing[i++] == 36, delegate string() => "$ expected", "/usr/include/dmd/phobos/std/format.d", 1288LU); | |
} | |
else | |
{ | |
this.width = to(widthOrArgIndex); | |
} | |
break; | |
} | |
case 46: | |
{ | |
if (cast(int)this.trailing[i += 1LU] == 42) | |
{ | |
if (isDigit(cast(dchar)this.trailing[i += 1LU])) | |
{ | |
this.trailing = this.trailing[i..__dollar]; | |
i = 0LU; | |
this.precision = -parse(this.trailing); | |
enforceEx(cast(int)this.trailing[i++] == 36, delegate string() => "$ expected", "/usr/include/dmd/phobos/std/format.d", 1308LU); | |
} | |
else | |
{ | |
this.precision = 2147483647; | |
} | |
} | |
else if (cast(int)this.trailing[i] == 45) | |
{ | |
this.precision = 0; | |
const(char)[] tmp = this.trailing[i..__dollar]; | |
parse(tmp); | |
i = cast(ulong)arrayPtrDiff(tmp, this.trailing); | |
} | |
else if (isDigit(cast(dchar)this.trailing[i])) | |
{ | |
const(char)[] tmp = this.trailing[i..__dollar]; | |
this.precision = parse(tmp); | |
i = cast(ulong)arrayPtrDiff(tmp, this.trailing); | |
} | |
else | |
{ | |
this.precision = 0; | |
} | |
break; | |
} | |
default: | |
{ | |
this.spec = this.trailing[i++]; | |
this.trailing = this.trailing[i..__dollar]; | |
return ; | |
} | |
} | |
} | |
} | |
} | |
throw new Exception(text("Incorrect format specifier: ", this.trailing), "/usr/include/dmd/phobos/std/format.d", 1344LU, null); | |
} | |
private bool readUpToNextSpec(R)(ref R r) | |
{ | |
import std.ascii : isLower, isWhite; | |
import std.utf : stride; | |
if (__ctfe) | |
{ | |
flDash = false; | |
flZero = false; | |
flSpace = false; | |
flPlus = false; | |
flHash = false; | |
} | |
else | |
{ | |
allFlags = 0; | |
} | |
width = 0; | |
precision = UNSPECIFIED; | |
nested = null; | |
while (trailing.length) | |
{ | |
const c = trailing[0]; | |
if (c == '%' && trailing.length > 1) | |
{ | |
const c2 = trailing[1]; | |
if (c2 == '%') | |
{ | |
assert(!r.empty); | |
if (r.front != '%') | |
break; | |
trailing = trailing[2..__dollar]; | |
r.popFront(); | |
} | |
else | |
{ | |
enforce(isLower(c2) || c2 == '*' || c2 == '(', text("'%", c2, "' not supported with formatted read")); | |
trailing = trailing[1..__dollar]; | |
fillUp(); | |
return true; | |
} | |
} | |
else | |
{ | |
if (c == ' ') | |
{ | |
while (!r.empty && isWhite(r.front)) | |
r.popFront(); | |
} | |
else | |
{ | |
enforce(!r.empty, text("parseToFormatSpec: Cannot find character '", c, "' in the input string.")); | |
if (r.front != trailing.front) | |
break; | |
r.popFront(); | |
} | |
trailing = trailing[stride(trailing, 0)..__dollar]; | |
} | |
} | |
return false; | |
} | |
private const pure @safe string getCurFmtStr() | |
{ | |
import std.array : appender; | |
Appender!string w = appender(); | |
FormatSpec!char f = f = FormatSpec , f.this("%s"); | |
put(w, '%'); | |
if (cast(int)this.indexStart != 0) | |
{ | |
formatValue(w, this.indexStart, f); | |
put(w, '$'); | |
} | |
if (this.flDash()) | |
put(w, '-'); | |
if (this.flZero()) | |
put(w, '0'); | |
if (this.flSpace()) | |
put(w, ' '); | |
if (this.flPlus()) | |
put(w, '+'); | |
if (this.flHash()) | |
put(w, '#'); | |
if (this.width != 0) | |
formatValue(w, this.width, f); | |
if (this.precision != 2147483646) | |
{ | |
put(w, '.'); | |
formatValue(w, this.precision, f); | |
} | |
put(w, this.spec); | |
return w.data(); | |
} | |
unittest | |
{ | |
import std.array; | |
Appender!string w = appender(); | |
FormatSpec!char f = f = FormatSpec , f.this("%.16f"); | |
f.writeUpToNextSpec(w); | |
assert(cast(int)f.spec == 102); | |
string fmt = f.getCurFmtStr(); | |
assert(fmt == "%.16f"); | |
} | |
private pure @safe const(char)[] headUpToNextSpec() | |
{ | |
import std.array : appender; | |
Appender!(const(char)[]) w = appender(); | |
const(char)[] tr = this.trailing; | |
for (; tr.length;) | |
{ | |
{ | |
if (cast(int)tr[0] == 37) | |
{ | |
if (tr.length > 1LU && cast(int)tr[1] == 37) | |
{ | |
tr = tr[2..__dollar]; | |
w.put('%'); | |
} | |
else | |
break; | |
} | |
else | |
{ | |
w.put(front(tr)); | |
popFront(tr); | |
} | |
} | |
} | |
return w.data(); | |
} | |
pure @safe string toString() | |
{ | |
assert(&this, "null this"); | |
return text("address = ", cast(void*)&this, "\x0awidth = ", this.width, "\x0aprecision = ", this.precision, "\x0aspec = ", this.spec, "\x0aindexStart = ", this.indexStart, "\x0aindexEnd = ", this.indexEnd, "\x0aflDash = ", this.flDash(), "\x0aflZero = ", this.flZero(), "\x0aflSpace = ", this.flSpace(), "\x0aflPlus = ", this.flPlus(), "\x0aflHash = ", this.flHash(), "\x0anested = ", this.nested, "\x0atrailing = ", this.trailing, "\x0a"); | |
} | |
} | |
bitfields!(uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
string bitfields = "private uint _fraction_exponent_sign;@property uint fraction() @safe pure nothrow @nogc const { auto result = (_fraction_exponent_sign & 8388607U) >>0U; return cast(uint) result;}\x0a@property void fraction(uint v) @safe pure nothrow @nogc { assert(v >= fraction_min, \"Value is smaller than the minimum value of bitfield 'fraction'\"); assert(v <= fraction_max, \"Value is greater than the maximum value of bitfield 'fraction'\"); _fraction_exponent_sign = cast(typeof(_fraction_exponent_sign)) ((_fraction_exponent_sign & ~cast(typeof(_fraction_exponent_sign))8388607U) | ((cast(typeof(_fraction_exponent_sign)) v << 0U) & 8388607U));}\x0aenum uint fraction_min = cast(uint)0U; enum uint fraction_max = cast(uint)8388607U; @property ubyte exponent() @safe pure nothrow @nogc const { auto result = (_fraction_exponent_sign & 2139095040U) >>23U; return cast(ubyte) result;}\x0a@property void exponent(ubyte v) @safe pure nothrow @nogc { assert(v >= exponent_min, \"Value is smaller than the minimum value of bitfield 'exponent'\"); assert(v <= exponent_max, \"Value is greater than the maximum value of bitfield 'exponent'\"); _fraction_exponent_sign = cast(typeof(_fraction_exponent_sign)) ((_fraction_exponent_sign & ~cast(typeof(_fraction_exponent_sign))2139095040U) | ((cast(typeof(_fraction_exponent_sign)) v << 23U) & 2139095040U));}\x0aenum ubyte exponent_min = cast(ubyte)0U; enum ubyte exponent_max = cast(ubyte)255U; @property bool sign() @safe pure nothrow @nogc const { return (_fraction_exponent_sign & 2147483648U) != 0;}\x0a@property void sign(bool v) @safe pure nothrow @nogc { if (v) _fraction_exponent_sign |= 2147483648U;else _fraction_exponent_sign &= ~cast(typeof(_fraction_exponent_sign))2147483648U;}\x0a"createStorageAndFields!(uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
createStoreName!(uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
enum string createStoreName = "_fraction_exponent_sign"; | |
createStoreName!(ubyte, "exponent", 8, bool, "sign", 1) | |
enum string createStoreName = "_exponent_sign"; | |
createStoreName!(bool, "sign", 1) | |
enum string createStoreName = "_sign"; | |
createStoreName!() | |
enum string createStoreName = ""; | |
sizeOfBitField!(uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
enum int sizeOfBitField = 32; | |
sizeOfBitField!(ubyte, "exponent", 8, bool, "sign", 1) | |
enum int sizeOfBitField = 9; | |
sizeOfBitField!(bool, "sign", 1) | |
enum int sizeOfBitField = 1; | |
sizeOfBitField!() | |
enum int sizeOfBitField = 0; | |
createFields!("_fraction_exponent_sign", 0LU, uint, "fraction", 23, ubyte, "exponent", 8, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", uint, "fraction", 23LU, 0LU) | |
createFields!("_fraction_exponent_sign", 23LU, ubyte, "exponent", 8, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", ubyte, "exponent", 8LU, 23LU) | |
createFields!("_fraction_exponent_sign", 31LU, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", bool, "sign", 1LU, 31LU) | |
createFields!("_fraction_exponent_sign", 32LU) | |
bitfields!(ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
string bitfields = "private ulong _fraction_exponent_sign;@property ulong fraction() @safe pure nothrow @nogc const { auto result = (_fraction_exponent_sign & 4503599627370495UL) >>0U; return cast(ulong) result;}\x0a@property void fraction(ulong v) @safe pure nothrow @nogc { assert(v >= fraction_min, \"Value is smaller than the minimum value of bitfield 'fraction'\"); assert(v <= fraction_max, \"Value is greater than the maximum value of bitfield 'fraction'\"); _fraction_exponent_sign = cast(typeof(_fraction_exponent_sign)) ((_fraction_exponent_sign & ~cast(typeof(_fraction_exponent_sign))4503599627370495UL) | ((cast(typeof(_fraction_exponent_sign)) v << 0U) & 4503599627370495UL));}\x0aenum ulong fraction_min = cast(ulong)0U; enum ulong fraction_max = cast(ulong)4503599627370495UL; @property ushort exponent() @safe pure nothrow @nogc const { auto result = (_fraction_exponent_sign & 9218868437227405312UL) >>52U; return cast(ushort) result;}\x0a@property void exponent(ushort v) @safe pure nothrow @nogc { assert(v >= exponent_min, \"Value is smaller than the minimum value of bitfield 'exponent'\"); assert(v <= exponent_max, \"Value is greater than the maximum value of bitfield 'exponent'\"); _fraction_exponent_sign = cast(typeof(_fraction_exponent_sign)) ((_fraction_exponent_sign & ~cast(typeof(_fraction_exponent_sign))9218868437227405312UL) | ((cast(typeof(_fraction_exponent_sign)) v << 52U) & 9218868437227405312UL));}\x0aenum ushort exponent_min = cast(ushort)0U; enum ushort exponent_max = cast(ushort)2047U; @property bool sign() @safe pure nothrow @nogc const { return (_fraction_exponent_sign & 9223372036854775808UL) != 0;}\x0a@property void sign(bool v) @safe pure nothrow @nogc { if (v) _fraction_exponent_sign |= 9223372036854775808UL;else _fraction_exponent_sign &= ~cast(typeof(_fraction_exponent_sign))9223372036854775808UL;}\x0a"createStorageAndFields!(ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
createStoreName!(ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
enum string createStoreName = "_fraction_exponent_sign"; | |
createStoreName!(ushort, "exponent", 11, bool, "sign", 1) | |
enum string createStoreName = "_exponent_sign"; | |
sizeOfBitField!(ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
enum int sizeOfBitField = 64; | |
sizeOfBitField!(ushort, "exponent", 11, bool, "sign", 1) | |
enum int sizeOfBitField = 12; | |
createFields!("_fraction_exponent_sign", 0LU, ulong, "fraction", 52, ushort, "exponent", 11, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", ulong, "fraction", 52LU, 0LU) | |
createFields!("_fraction_exponent_sign", 52LU, ushort, "exponent", 11, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", ushort, "exponent", 11LU, 52LU) | |
createFields!("_fraction_exponent_sign", 63LU, bool, "sign", 1) | |
createAccessors!("_fraction_exponent_sign", bool, "sign", 1LU, 63LU) | |
createFields!("_fraction_exponent_sign", 64LU) | |
bitfields!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
string bitfields = "private ubyte _flDash_flZero_flSpace_flPlus_flHash_;@property bool flDash() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 1U) != 0;}\x0a@property void flDash(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 1U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))1U;}\x0a@property bool flZero() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 2U) != 0;}\x0a@property void flZero(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 2U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))2U;}\x0a@property bool flSpace() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 4U) != 0;}\x0a@property void flSpace(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 4U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))4U;}\x0a@property bool flPlus() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 8U) != 0;}\x0a@property void flPlus(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 8U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))8U;}\x0a@property bool flHash() @safe pure nothrow @nogc const { return (_flDash_flZero_flSpace_flPlus_flHash_ & 16U) != 0;}\x0a@property void flHash(bool v) @safe pure nothrow @nogc { if (v) _flDash_flZero_flSpace_flPlus_flHash_ |= 16U;else _flDash_flZero_flSpace_flPlus_flHash_ &= ~cast(typeof(_flDash_flZero_flSpace_flPlus_flHash_))16U;}\x0a"createStorageAndFields!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createStoreName!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flDash_flZero_flSpace_flPlus_flHash_"; | |
createStoreName!(bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flZero_flSpace_flPlus_flHash_"; | |
createStoreName!(bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flSpace_flPlus_flHash_"; | |
createStoreName!(bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flPlus_flHash_"; | |
createStoreName!(bool, "flHash", 1, ubyte, "", 3) | |
enum string createStoreName = "_flHash_"; | |
createStoreName!(ubyte, "", 3) | |
enum string createStoreName = "_"; | |
sizeOfBitField!(bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 8; | |
sizeOfBitField!(bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 7; | |
sizeOfBitField!(bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 6; | |
sizeOfBitField!(bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 5; | |
sizeOfBitField!(bool, "flHash", 1, ubyte, "", 3) | |
enum int sizeOfBitField = 4; | |
sizeOfBitField!(ubyte, "", 3) | |
enum int sizeOfBitField = 3; | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 0LU, bool, "flDash", 1, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flDash", 1LU, 0LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 1LU, bool, "flZero", 1, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flZero", 1LU, 1LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 2LU, bool, "flSpace", 1, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flSpace", 1LU, 2LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 3LU, bool, "flPlus", 1, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flPlus", 1LU, 3LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 4LU, bool, "flHash", 1, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", bool, "flHash", 1LU, 4LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 5LU, ubyte, "", 3) | |
createAccessors!("_flDash_flZero_flSpace_flPlus_flHash_", ubyte, "", 3LU, 5LU) | |
createFields!("_flDash_flZero_flSpace_flPlus_flHash_", 8LU) | |
isNarrowString!(int[]) | |
enum bool isNarrowString = false; | |
isAggregateType!(int[]) | |
enum bool isAggregateType = false; | |
isStaticArray!(int[]) | |
enum bool isStaticArray = false; | |
popFront!int | |
pure nothrow @nogc @safe void popFront(ref int[] a) | |
{ | |
assert(a.length, "Attempting to popFront() past the end of an array of int"); | |
a = a[1..__dollar]; | |
} | |
isNarrowString!(immutable(int)[]) | |
enum bool isNarrowString = false; | |
isAggregateType!(immutable(int)[]) | |
enum bool isAggregateType = false; | |
isStaticArray!(immutable(int)[]) | |
enum bool isStaticArray = false; | |
popFront!(immutable(int)) | |
pure nothrow @nogc @safe void popFront(ref immutable(int)[] a) | |
{ | |
assert(a.length, "Attempting to popFront() past the end of an array of immutable(int)"); | |
a = a[1..__dollar]; | |
} | |
isNarrowString!(void[]) | |
enum bool isNarrowString = false; | |
isAggregateType!(void[]) | |
enum bool isAggregateType = false; | |
isStaticArray!(void[]) | |
enum bool isStaticArray = false; | |
popBack!(immutable(int)) | |
pure nothrow @nogc @safe void popBack(ref immutable(int)[] a) | |
{ | |
assert(a.length); | |
a = a[0..__dollar - 1LU]; | |
} | |
popBack!int | |
pure nothrow @nogc @safe void popBack(ref int[] a) | |
{ | |
assert(a.length); | |
a = a[0..__dollar - 1LU]; | |
} | |
blockAttribute!void | |
enum int blockAttribute = 0; | |
hasIndirections!void | |
enum bool hasIndirections = false; | |
isStaticArray!void | |
enum bool isStaticArray = false; | |
isFunctionPointer!void | |
enum bool isFunctionPointer = false; | |
isPointer!void | |
enum bool isPointer = false; | |
isAggregateType!void | |
enum bool isAggregateType = false; | |
isDelegate!void | |
enum bool isDelegate = false; | |
isDynamicArray!void | |
enum bool isDynamicArray = false; | |
OriginalType!void | |
alias OriginalType = void; | |
ModifyTypePreservingTQ!(Impl, void) | |
alias ModifyTypePreservingTQ = void; | |
Modifier!void | |
alias Impl = void; | |
Unqual!void | |
alias Unqual = void; | |
isAssociativeArray!void | |
enum bool isAssociativeArray = false; | |
nDimensions!(uint[]) | |
enum int nDimensions = 1; | |
isArray!(uint[]) | |
enum bool isArray = true; | |
isStaticArray!(uint[]) | |
enum bool isStaticArray = false; | |
isDynamicArray!(uint[]) | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!(uint[]) | |
alias DynamicArrayTypeOf = uint[]; | |
isAggregateType!(uint[]) | |
enum bool isAggregateType = false; | |
OriginalType!(uint[]) | |
alias OriginalType = uint[]; | |
ModifyTypePreservingTQ!(Impl, uint[]) | |
alias ModifyTypePreservingTQ = uint[]; | |
Modifier!(uint[]) | |
alias Impl = uint[]; | |
Unqual!(uint[]) | |
alias Unqual = uint[]; | |
nDimensions!uint | |
enum int nDimensions = 0; | |
isArray!uint | |
enum bool isArray = false; | |
isStaticArray!uint | |
enum bool isStaticArray = false; | |
isDynamicArray!uint | |
enum bool isDynamicArray = false; | |
isAggregateType!uint | |
enum bool isAggregateType = false; | |
OriginalType!uint | |
alias OriginalType = uint; | |
ModifyTypePreservingTQ!(Impl, uint) | |
alias ModifyTypePreservingTQ = uint; | |
Modifier!uint | |
alias Impl = uint; | |
nDimensions!(float[][]) | |
enum int nDimensions = 2; | |
isArray!(float[][]) | |
enum bool isArray = true; | |
isStaticArray!(float[][]) | |
enum bool isStaticArray = false; | |
isDynamicArray!(float[][]) | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!(float[][]) | |
alias DynamicArrayTypeOf = float[][]; | |
isAggregateType!(float[][]) | |
enum bool isAggregateType = false; | |
OriginalType!(float[][]) | |
alias OriginalType = float[][]; | |
ModifyTypePreservingTQ!(Impl, float[][]) | |
alias ModifyTypePreservingTQ = float[][]; | |
Modifier!(float[][]) | |
alias Impl = float[][]; | |
Unqual!(float[][]) | |
alias Unqual = float[][]; | |
nDimensions!(float[]) | |
enum int nDimensions = 1; | |
isArray!(float[]) | |
enum bool isArray = true; | |
isStaticArray!(float[]) | |
enum bool isStaticArray = false; | |
isDynamicArray!(float[]) | |
enum bool isDynamicArray = true; | |
DynamicArrayTypeOf!(float[]) | |
alias DynamicArrayTypeOf = float[]; | |
isAggregateType!(float[]) | |
enum bool isAggregateType = false; | |
OriginalType!(float[]) | |
alias OriginalType = float[]; | |
ModifyTypePreservingTQ!(Impl, float[]) | |
alias ModifyTypePreservingTQ = float[]; | |
Modifier!(float[]) | |
alias Impl = float[]; | |
Unqual!(float[]) | |
alias Unqual = float[]; | |
nDimensions!float | |
enum int nDimensions = 0; | |
isArray!float | |
enum bool isArray = false; | |
isStaticArray!float | |
enum bool isStaticArray = false; | |
isDynamicArray!float | |
enum bool isDynamicArray = false; | |
isAggregateType!float | |
enum bool isAggregateType = false; | |
OriginalType!float | |
alias OriginalType = float; | |
ModifyTypePreservingTQ!(Impl, float) | |
alias ModifyTypePreservingTQ = float; | |
Modifier!float | |
alias Impl = float; | |
Unqual!float | |
alias Unqual = float; | |
formatGeneric!(Appender!string, ubyte, char) | |
pure @system void formatGeneric(Appender!string w, const(void)* arg, ref const(FormatSpec!char) f) | |
{ | |
formatValue(w, *cast(ubyte*)arg, f); | |
} | |
OriginalType!ubyte | |
alias OriginalType = ubyte; | |
ModifyTypePreservingTQ!(Impl, ubyte) | |
alias ModifyTypePreservingTQ = ubyte; | |
Modifier!ubyte | |
alias Impl = ubyte; | |
IntegralTypeOf!ubyte | |
alias IntegralTypeOf = ubyte; | |
staticIndexOf!(ubyte, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = 1; | |
genericIndexOf!(ubyte, byte, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(ubyte, byte) | |
enum bool isSame = false; | |
genericIndexOf!(ubyte, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(ubyte, ubyte) | |
enum bool isSame = true; | |
hasToString!(ubyte, char) | |
enum int hasToString = 0; | |
isPointer!ubyte | |
enum bool isPointer = false; | |
TypeTuple!(float, double, real) | |
alias AliasSeq = (float, double, real); | |
staticIndexOf!(ubyte, float, double, real) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(ubyte, float, double, real) | |
OldAlias!float | |
alias OldAlias = float; | |
isSame!(ubyte, float) | |
enum bool isSame = false; | |
expectType!float | |
genericIndexOf!(ubyte, double, real) | |
isAggregateType!double | |
enum bool isAggregateType = false; | |
OldAlias!double | |
alias OldAlias = double; | |
isSame!(ubyte, double) | |
enum bool isSame = false; | |
expectType!double | |
genericIndexOf!(ubyte, real) | |
isAggregateType!real | |
enum bool isAggregateType = false; | |
OldAlias!real | |
alias OldAlias = real; | |
isSame!(ubyte, real) | |
enum bool isSame = false; | |
expectType!real | |
genericIndexOf!ubyte | |
staticIndexOf!(ubyte, char, wchar, dchar) | |
enum int staticIndexOf = -1; | |
genericIndexOf!(ubyte, char, wchar, dchar) | |
isSame!(ubyte, char) | |
enum bool isSame = false; | |
genericIndexOf!(ubyte, wchar, dchar) | |
isSame!(ubyte, wchar) | |
enum bool isSame = false; | |
genericIndexOf!(ubyte, dchar) | |
isSame!(ubyte, dchar) | |
enum bool isSame = false; | |
isDelegate!ubyte | |
enum bool isDelegate = false; | |
formatValue!(Appender!string, ubyte, char) | |
pure @safe void formatValue(Appender!string w, ubyte obj, ref const(FormatSpec!char) f) | |
{ | |
alias U = ubyte; | |
ubyte val = obj; | |
if (cast(int)f.spec == 114) | |
{ | |
scope const(char)[] raw = (*function (return ref ubyte val) => (cast(const(char*))&val)[0..1])(val); | |
if (needToSwapEndianess(f)) | |
{ | |
{ | |
scope const(char)[] __r2277 = raw[]; | |
ulong __key2278 = __r2277.length; | |
for (; __key2278--;) | |
{ | |
const const(char) c = __r2277[__key2278]; | |
put(w, c); | |
} | |
} | |
} | |
else | |
{ | |
{ | |
scope const(char)[] __r2302 = raw[]; | |
ulong __key2303 = 0LU; | |
for (; __key2303 < __r2302.length; __key2303 += 1LU) | |
{ | |
const const(char) c = __r2302[__key2303]; | |
put(w, c); | |
} | |
} | |
} | |
return ; | |
} | |
immutable immutable(uint) base = cast(int)f.spec == 120 || cast(int)f.spec == 88 ? 16u : cast(int)f.spec == 111 ? 8u : cast(int)f.spec == 98 ? 2u : cast(int)f.spec == 115 || cast(int)f.spec == 100 || cast(int)f.spec == 117 ? 10u : 0u; | |
enforceEx(base > 0u, delegate string() => "integral", "/usr/include/dmd/phobos/std/format.d", 1744LU); | |
alias C = ulong; | |
formatIntegral(w, cast(ulong)val, f, base, 255LU); | |
} | |
__lambda4!ubyte | |
function (return ref ubyte val) => (cast(const(char*))&val)[0..1]needToSwapEndianess!char | |
pure nothrow @nogc @safe bool needToSwapEndianess(ref const(FormatSpec!char) f) | |
{ | |
import std.system : endian, Endian; | |
return f.flPlus() || false; | |
} | |
put!(Appender!string, const(char)) | |
pure nothrow @safe void put(ref Appender!string r, const(char) e) | |
{ | |
doPut(r, e); | |
} | |
doPut!(Appender!string, const(char)) | |
pure nothrow @safe void doPut(ref Appender!string r, ref const(char) e) | |
{ | |
enum bool usingPut = true; | |
r.put(e); | |
} | |
hasMember!(Appender!string, "put") | |
enum bool hasMember = true; | |
canPutItem!(const(char)) | |
enum bool canPutItem = true; | |
isImplicitlyConvertible!(const(char), immutable(char)) | |
enum bool isImplicitlyConvertible = true; | |
isSomeChar!(immutable(char)) | |
enum bool isSomeChar = true; | |
CharTypeOf!(immutable(char)) | |
alias CharTypeOf = immutable(char); | |
isAggregateType!(immutable(char)) | |
enum bool isAggregateType = false; | |
OriginalType!(immutable(char)) | |
alias OriginalType = immutable(char); | |
ModifyTypePreservingTQ!(Impl, immutable(char)) | |
alias ModifyTypePreservingTQ = immutable immutable(char); | |
Modifier!char | |
alias Impl = char; | |
isSomeChar!(const(char)) | |
enum bool isSomeChar = true; | |
CharTypeOf!(const(char)) | |
alias CharTypeOf = const(char); | |
isAggregateType!(const(char)) | |
enum bool isAggregateType = false; | |
OriginalType!(const(char)) | |
alias OriginalType = const(char); | |
ModifyTypePreservingTQ!(Impl, const(char)) | |
alias ModifyTypePreservingTQ = const const(char); | |
Modifier!char | |
alias Impl = char; | |
Unqual!(const(char)) | |
alias Unqual = char; | |
canPutConstRange!(const(char)) | |
enum bool canPutConstRange = false; | |
isInputRange!char | |
enum bool isInputRange = false; | |
isInputRange!(const(char)) | |
enum bool isInputRange = false; | |
canPutRange!(const(char)) | |
enum bool canPutRange = false; | |
put!(const(char)) | |
pure nothrow @safe void put(const(char) item) | |
{ | |
assert(&this, "null this"); | |
import std.conv : emplaceRef; | |
this.ensureAddable(1LU); | |
immutable immutable(ulong) len = (*this._data).arr.length; | |
char[] bigData = delegate () => (cast(char*)(*this._data).arr)[0..len + 1LU](); | |
emplaceRef(bigData[len], item); | |
(*this._data).arr = bigData; | |
} | |
appenderNewCapacity!1LU | |
pure nothrow @nogc @safe ulong appenderNewCapacity(ulong curLen, ulong reqLen) | |
{ | |
import core.bitop : bsr; | |
import std.algorithm.comparison : max; | |
if (curLen == 0LU) | |
return max(reqLen, 8); | |
ulong mult = 100LU + 1000LU / cast(ulong)(bsr(curLen * 1LU) + 1); | |
if (mult > 200LU) | |
mult = 200LU; | |
ulong sugLen = (curLen * mult + 99LU) / 100LU; | |
return max(reqLen, sugLen); | |
} | |
max!(ulong, int) | |
pure nothrow @nogc @safe ulong max(ulong _param_0, int _param_1) | |
{ | |
alias a = ulong _param_0; | |
; | |
alias T0 = ulong; | |
alias b = int _param_1; | |
; | |
alias T1 = int; | |
import std.algorithm.internal : algoFormat; | |
import std.functional : lessThan; | |
immutable immutable(bool) chooseB = safeOp(_param_0, _param_1); | |
return chooseB ? cast(ulong)_param_1 : _param_0; | |
} | |
MaxType!(ulong, int) | |
alias MaxType = ulong; | |
safeOp!"<" | |
bool safeOp(T0, T1)(auto ref T0 a, auto ref T1 b) | |
{ | |
import std.traits : mostNegative; | |
static if (isIntegral!T0 | |
&& isIntegral!T1 | |
&& (mostNegative!T0 | |
< 0) != (mostNegative!T1 | |
< 0)) | |
{ | |
static if (S == "<=" || S == "<") | |
{ | |
static if (mostNegative!T0 | |
< 0) | |
{ | |
immutable result = a < 0 || unsafeOp(a, b); | |
} | |
else | |
{ | |
immutable result = b >= 0 && unsafeOp(a, b); | |
} | |
} | |
else | |
{ | |
static if (mostNegative!T0 | |
< 0) | |
{ | |
immutable result = a >= 0 && unsafeOp(a, b); | |
} | |
else | |
{ | |
immutable result = b < 0 || unsafeOp(a, b); | |
} | |
} | |
} | |
else | |
{ | |
static assert(is(typeof(mixin("a " ~ S ~ " b"))), "Invalid arguments: Cannot compare types " ~ T0.stringof ~ " and " ~ T1.stringof ~ "."); | |
immutable result = mixin("a " ~ S ~ " b"); | |
} | |
return result; | |
} | |
safeOp!(ulong, int) | |
pure nothrow @nogc @safe bool safeOp(ref ulong a, ref int b) | |
{ | |
import std.traits : mostNegative; | |
immutable immutable(bool) result = b >= 0 && unsafeOp(a, b); | |
return result; | |
} | |
isIntegral!ulong | |
enum bool isIntegral = true; | |
IntegralTypeOf!ulong | |
alias IntegralTypeOf = ulong; | |
isAggregateType!ulong | |
enum bool isAggregateType = false; | |
OriginalType!ulong | |
alias OriginalType = ulong; | |
ModifyTypePreservingTQ!(Impl, ulong) | |
alias ModifyTypePreservingTQ = ulong; | |
Modifier!ulong | |
alias Impl = ulong; | |
Unqual!ulong | |
alias Unqual = ulong; | |
staticIndexOf!(ulong, byte, ubyte, short, ushort, int, uint, long, ulong) | |
enum int staticIndexOf = 7; | |
genericIndexOf!(ulong, byte, ubyte, short, ushort, int, uint, long, ulong) | |
OldAlias!ulong | |
alias OldAlias = ulong; | |
isSame!(ulong, byte) | |
enum bool isSame = false; | |
expectType!ulong | |
genericIndexOf!(ulong, ubyte, short, ushort, int, uint, long, ulong) | |
isSame!(ulong, ubyte) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, short, ushort, int, uint, long, ulong) | |
isSame!(ulong, short) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, ushort, int, uint, long, ulong) | |
isSame!(ulong, ushort) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, int, uint, long, ulong) | |
isSame!(ulong, int) | |
enum bool isSame = false; | |
genericIndexOf!(ulong, uint, long, ulong) | |
OldAlias!uint | |
alias OldAlias = uint; | |
isSame!(ulong, uint) | |
enum bool isSame = false; | |
expectType!uint | |
genericIndexOf!(ulong, long, ulong) | |
isAggregateType!long | |
enum bool isAggregateType = false; | |
OldAlias!long | |
alias OldAlias = long; | |
isSame!(ulong, long) | |
enum bool isSame = false; | |
expectType!long | |
genericIndexOf!(ulong, ulong) | |
isSame!(ulong, ulong) | |
enum bool isSame = true; | |
isNumeric!ulong | |
enum bool isNumeric = true; | |
mostNegative!ulong | |
enum byte mostNegative = cast(byte)0; | |
isNumeric!int | |
enum bool isNumeric = true; | |
mostNegative!int | |
enum int mostNegative = -2147483648; | |
unsafeOp!(ulong, int) | |
pure nothrow @nogc @safe bool unsafeOp(ulong a, int b) | |
{ | |
import std.traits : CommonType; | |
alias T = ulong; | |
return a < cast(ulong)b; | |
} | |
CommonType!(ulong, int) | |
alias CommonType = ulong; | |
CommonType!ulong | |
alias CommonType = ulong; | |
max!(ulong, ulong) | |
pure nothrow @nogc @safe ulong max(ulong _param_0, ulong _param_1) | |
{ | |
alias a = ulong _param_0; | |
; | |
alias T0 = ulong; | |
alias b = ulong _param_1; | |
; | |
alias T1 = ulong; | |
import std.algorithm.internal : algoFormat; | |
import std.functional : lessThan; | |
immutable immutable(bool) chooseB = safeOp(_param_0, _param_1); | |
return chooseB ? _param_1 : _param_0; | |
} | |
MaxType!(ulong, ulong) | |
alias MaxType = ulong; | |
safeOp!(ulong, ulong) | |
pure nothrow @nogc @safe bool safeOp(ref ulong a, ref ulong b) | |
{ | |
import std.traits : mostNegative; | |
immutable immutable(bool) result = a < b; | |
return result; | |
} | |
blockAttribute!(immutable(char)) | |
enum BlkAttr blockAttribute = BlkAttr.NO_SCAN; | |
hasIndirections!(immutable(char)) | |
enum bool hasIndirections = false; | |
isStaticArray!(immutable(char)) | |
enum bool isStaticArray = false; | |
isFunctionPointer!(immutable(char)) | |
enum bool isFunctionPointer = false; | |
isPointer!(immutable(char)) | |
enum bool isPointer = false; | |
isDelegate!(immutable(char)) | |
enum bool isDelegate = false; | |
isDynamicArray!(immutable(char)) | |
enum bool isDynamicArray = false; | |
isAssociativeArray!(immutable(char)) | |
enum bool isAssociativeArray = false; | |
emplaceRef!(char, char, char) | |
pure nothrow @nogc @safe void emplaceRef(ref char chunk, char _param_1) | |
{ | |
static struct S | |
{ | |
char payload; | |
pure nothrow @nogc @safe this(ref char _param_0) | |
{ | |
this.payload = _param_0; | |
return this; | |
} | |
} | |
if (__ctfe) | |
{ | |
chunk = _param_1; | |
} | |
else | |
{ | |
S* p = delegate () => cast(S*)&chunk(); | |
emplaceInitializer(*p); | |
(*p).this(_param_1); | |
} | |
} | |
RTInfo!(S) | |
enum typeof(null) RTInfo = null; | |
emplaceInitializer!(S) | |
pure nothrow @nogc @trusted void emplaceInitializer(ref S chunk) | |
{ | |
chunk = S('\xff'); | |
} | |
hasElaborateAssign!(S) | |
enum bool hasElaborateAssign = false; | |
isStaticArray!(S) | |
enum bool isStaticArray = false; | |
FieldTypeTuple!(S) | |
alias Fields = (char); | |
isNested!(S) | |
enum bool isNested = false; | |
anySatisfy!(hasElaborateAssign, char) | |
enum bool anySatisfy = false; | |
F!char | |
enum bool hasElaborateAssign = false; | |
isStaticArray!char | |
enum bool isStaticArray = false; | |
isAssignable!(S, S) | |
enum bool isAssignable = true; | |
isRvalueAssignable!(S, S) | |
enum bool isRvalueAssignable = true; | |
lvalueOf!(S) | |
@property ref S lvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
rvalueOf!(S) | |
@property S rvalueOf(inout(__InoutWorkaroundStruct) = __InoutWorkaroundStruct()); | |
isLvalueAssignable!(S, S) | |
enum bool isLvalueAssignable = true; | |
enforceEx!(FormatException) | |
T enforceEx(T)(T value, lazy string msg = "", string file = __FILE__, size_t line = __LINE__) | |
{ | |
if (!value) | |
throw new E(msg, file, line); | |
return value; | |
} | |
enforceEx!bool | |
pure @safe bool enforceEx(bool value, lazy string msg = "", string file = __FILE__, ulong line = cast(ulong)__LINE__) | |
{ | |
if (!value) | |
throw new FormatException(msg(), file, line, null); | |
return value; | |
} | |
isSigned!ubyte | |
enum bool isSigned = false; | |
Unsigned!ubyte | |
alias Unsigned = ubyte; | |
ModifyTypePreservingTQ!(Impl, ubyte) | |
alias ModifyTypePreservingTQ = ubyte; | |
Modifier!ubyte | |
alias Impl = ubyte; | |
isUnsigned!ubyte | |
enum bool isUnsigned = true; | |
formatIntegral!(Appender!string, ulong, char) | |
< |