I have this structure:

struct Scene
{
        Array!Surface objects;  // objects in the scene
        Array!Light lights;             // lights in the scene
        
        /*private*/ BVHNode root;                       // root node of the BVH 
tree
        
@disable this(); // disable the default constructor because space needs to be reserved for objects and lights
        
this(size_t objectReserveSpace = 20, size_t lightReserveSpace = 3)
        {
                objects.reserve(objectReserveSpace);
                lights.reserve(lightReserveSpace);
        }
}



auto scene = Scene(); // error about @disabled constructor

Yes, the default constructor is @disabled BUT I am not using that one. I want to use the other one - the custom constructor. I guess it signals an error because it has those defaults parameters. But shouldn't the compiler choose that one?

Reply via email to