isDigest

Use this to check if a type is a digest. See ExampleDigest to see what a type must provide to pass this check.

Note: This is very useful as a template constraint (see examples)

template isDigest (
T
) {
enum bool isDigest;
}

Bugs

  • Does not yet verify that put takes scope parameters.
  • Should check that finish() returns a ubytenum array

Examples

import std.digest.crc;
static assert(isDigest!CRC32);
import std.digest.crc;
void myFunction(T)()
if (isDigest!T)
{
    T dig;
    dig.start();
    auto result = dig.finish();
}
myFunction!CRC32();

Meta