On Saturday, 22 March 2014 at 10:02:39 UTC, bearophile wrote:
MarisaLovesUsAll:

Hi! I need to use array of bits in my custom class. I tried to
add std.bitmanip.BitArray as field, but got a strange error. What
am I doing wrong?

import std.bitmanip;
class Scene
{
    BitArray collisionMap;
    this(int w, int h)
    {
        collisionMap.init([0,0,0]);
    }
}

C:\D\dmd2\windows\bin\..\..\src\phobos\std\bitmanip.d
line 606
Error: btr cannot be interpreted at compile time, because it has
no available source code

To me this program compiles:


import std.bitmanip;

class Scene {
     BitArray collisionMap;
     this(int w, int h) {
         collisionMap.init([0,0,0]);
     }
}
void main() {}


Errors like "btr cannot be interpreted at compile time" mean that you are trying to run at compile-time something that can only run at run-time. So are you using enums or static immutables or static constructors or something like that?

Bye,
bearophile

Thanks for help! It was static(?) ctor, I had been trying to create Scene from another class via
class App
{
    Scene scene = new Scene(13,10);
}

Reply via email to