TakesParams

Given a function and a tuple of types, evaluates whether that function could be called with that tuple as parameters. Alias version (works on functions, not function types.)

Qualifiers like const andimmutable are skipped, which may make it a poor choice if dealing with functions that require such arguments.

It is merely syntactic sugar, using std.meta and std.traits behind the scenes.

Members

Aliases

FunParams
alias FunParams = staticMap!(Unqual, Parameters!fun)
Undocumented in source.
PassedParams
alias PassedParams = staticMap!(Unqual, P)
Undocumented in source.

Imports

Parameters (from std.traits)
public import std.traits : Parameters, Unqual, staticMap;
Undocumented in source.
Unqual (from std.traits)
public import std.traits : Parameters, Unqual, staticMap;
Undocumented in source.
staticMap (from std.traits)
public import std.traits : Parameters, Unqual, staticMap;
Undocumented in source.

Manifest constants

TakesParams
enum TakesParams;
Undocumented in source.
TakesParams
enum TakesParams;
Undocumented in source.

Parameters

fun

Function to evaluate the parameters of.

P

Variadic list of types to compare fun's function parameters with.

Examples

void noParams();
bool boolParam(bool);
string stringParam(string);
float floatParam(float);

static assert(TakesParams!(noParams));
static assert(TakesParams!(boolParam, bool));
static assert(TakesParams!(stringParam, string));
static assert(TakesParams!(floatParam, float));
void foo();
void foo1(string);
void foo2(string, int);
void foo3(bool, bool, bool);

static assert(TakesParams!(foo));//, AliasSeq!()));
static assert(TakesParams!(foo1, string));
static assert(TakesParams!(foo2, string, int));
static assert(TakesParams!(foo3, bool, bool, bool));

static assert(!TakesParams!(foo, string));
static assert(!TakesParams!(foo1, string, int));
static assert(!TakesParams!(foo2, bool, bool, bool));

Meta