Skip to content

Instantly share code, notes, and snippets.

@AnhNhan
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnhNhan/9820226 to your computer and use it in GitHub Desktop.
Save AnhNhan/9820226 to your computer and use it in GitHub Desktop.
// The column struct, with the array
struct Column
{
State[] states;
private bool[State] _uniques;
bool add(ref State state)
{
if (state in _uniques)
{
return false;
}
state.end_column = &this;
_uniques[state] = true;
states ~= state;
return true;
}
}
// The iteration
foreach (state; col.states)
{
// ...
col.add(State(...));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment