CT BitArray
Bastiaan Veelo
Bastiaan at Veelo.net
Thu Apr 2 12:26:18 UTC 2020
On Thursday, 1 November 2018 at 08:50:38 UTC, Bastiaan Veelo
wrote:
> On Thursday, 1 November 2018 at 00:01:04 UTC, Stefan Koch wrote:
>> On Wednesday, 31 October 2018 at 23:14:08 UTC, Bastiaan Veelo
>> wrote:
>>> Currently, BitArray is not usable at compile time, so you
>>> cannot do
>>> ```
>>> enum e = BitArray([1, 1, 1, 0]);
>>> ```
>>> This gives
>>>> /dlang/dmd/linux/bin64/../../src/phobos/std/bitmanip.d(1190): Error: `bts` cannot be interpreted at compile time, because it has no available source code
[....]
> meanwhile use module level BitArrays like
> ```
> immutable BitArray e;
> static this()
> {
> e = BitArray([1, 1, 1, 0]);
> }
> ```
Note to self: when this occurs, the above error message does not
offer a trace to the place where this originates. To get that,
temporarily insert the following at the indicated line in
bitmanip.d:
```
if(__ctfe) assert(false, "trap");
```
--Bastiaan.
More information about the Digitalmars-d-learn
mailing list