Skip to content

Instantly share code, notes, and snippets.

@crazymonkyyy
Created March 7, 2026 20:34
Show Gist options
  • Select an option

  • Save crazymonkyyy/cc67a957c0726ff5fa8995ed6dccee60 to your computer and use it in GitHub Desktop.

Select an option

Save crazymonkyyy/cc67a957c0726ff5fa8995ed6dccee60 to your computer and use it in GitHub Desktop.
import std;
template padto(int I=1024){
align(I) void[0] __last__;
}
struct foo{
int a;
int b;
mixin padto!();
}
struct bar{
float f;
int[15] i;
mixin padto!();
}
static assert(foo.sizeof==bar.sizeof);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment