isNeighbourhood

Tests if something is a Neighbourhood.

returns true if T is a Neighbourhood of dimension N.

A Neighbourhood is the most basic form of a $(NEIGHBOURHOOD). It's getNeighboursCoordinates function takes a cells position and returns a list of coordinate pairs for it's neighbours positions.

It must define the primitive:
int[N][] getNeighboursCoordinates(Coord).
Where N is the dimension of the Neighbourhood and Coord is an alias for a typetuple containing int's, one int for each dimension (in a 3 dimensional Neighbourhood Coord would be: (int, int, int)).

Members

Aliases

Coord
alias Coord = Repeat!(N, int)
Undocumented in source.

Manifest constants

isNeighbourhood
enum isNeighbourhood;
Undocumented in source.
isNeighbourhood
enum isNeighbourhood;
Undocumented in source.

Parameters

T

type to be tested

N

number of dimensions

Return Value

true if T is a Neighbourhood, false if not

Examples

struct A {
	enum uint Dimension = 2;
	int[2][] getNeighboursCoordinates(int x, int y) {
		return [[x+1, y+1], [x+1, y], [x+1, y-1]];
	}
}

static assert( isNeighbourhood!(A, 2));
static assert(!isNeighbourhood!(string, 1));

Meta