Well, I humbly believe you would not be confused if you read documentation about BinaryHeap.
The first sentence clearly explains the crucial information:
Implements a binary heap container on top of a given random-access range type (usually T[]) or a random-access container type (usually Array!T).
Here is what you should do:
import std.stdio;
import std.container;
void main(string[] args) {
int[] arr = [1, 4, 12, 19];
auto bh = BinaryHeap!(int[])(arr);
writeln(bh.length); // prints 4
}
It is worth of reminding people that D array is a random-access range.