Skip to content

Instantly share code, notes, and snippets.

@andrey-zherikov
Created November 14, 2023 16:28
Show Gist options
  • Save andrey-zherikov/87675a4d6f4db62368c7b4d71df474a5 to your computer and use it in GitHub Desktop.
Save andrey-zherikov/87675a4d6f4db62368c7b4d71df474a5 to your computer and use it in GitHub Desktop.
ldc crash
enum Font
{
bold ,
underline ,
}
struct TextStyle
{
auto opBinary(string op)(ubyte other) {
return other ? TextStyle: this;
}
}
template StyleImpl(ubyte styleCode)
{
auto StyleImpl()
{
return TextStyle();
}
auto StyleImpl(TextStyle otherStyle)
{
return otherStyle ~ styleCode;
}
}
alias bold = StyleImpl!(Font.bold);
alias underline = StyleImpl!(Font.underline);
struct Style
{
TextStyle programName;
enum Default = Style(
bold.underline );
}
ldc2.exe package.d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment