Menu
Home
Create new Paste
Log in
http://stackoverflow.com/questions/11383240/custom-alignment-options-for-an-efficient-quad-edge-implementation
Code
Theme: cobalt
Theme: eclipse
Theme: elegant
Theme: monokai
Theme: neat
Theme: night
Theme: rubyblue
module so_0001; // http://stackoverflow.com/questions/11383240/custom-alignment-options-for-an-efficient-quad-edge-implementation struct edge(T) { edge* next; T* data; uint position; } alias edge!int iedge; alias edge!int[4] qedge; /* not a good idea for struct... it is a value type... edge!int new_edge() { // in the original example it used new... D is not C++ to mix value and reference types! :) } */ import std.stdio; int main() { writeln(iedge.sizeof); // 64bit // ---------- writeln(iedge.next.offsetof); // 0 writeln(iedge.data.offsetof); // 8 writeln(iedge.position.offsetof); // 16 writeln(qedge.sizeof); return 0; }
Result:
Success
/
Return code: 0
/
Compilation time:
1.337
seconds
/
Run time:
0.017
seconds
Application output:
24
0
8
16
96
Username
Message
Add comment
Paste info
Author:
dejan
Views:
202
Private:
no
Expires:
Never
Uploaded:
08.07.12 15:42
Tags:
alignment
struct
Votes
:
0
Tweet
Compilation
Compiler:
DMD 2.062
Pointer size:
m64
Actions
Download
Fork
Raw
×
Confirm
Are you sure you want to delete this paste?
There's no way back!
×
Confirm
Reason