Take exactly n element from range. Throws an exception if range has not enough elements.
Exception if range has less than n elements.
import std.exception : assertThrown; import std.range : iota; static assert(is(typeof(iota(10).takeExactly!5) == int[5])); assert(iota(10).takeExactly!5 == [0, 1, 2, 3, 4]); assertThrown!Exception(iota(2).takeExactly!5);
See Implementation
Take exactly n element from range. Throws an exception if range has not enough elements.