Skip to content
  • Kenneth Moreland's avatar
    Fix issues with Field constructor overloads · f9750e83
    Kenneth Moreland authored
    I ran into a few minor issues with the constructors to the Field class.
    
    The big change I made was that I removed the Field constructors that
    take an example type and create an empty field of that type. The problem
    was that the example type was easily confused with some other type that
    was supposed to describe an array. This lead to some odd behavior in the
    compiler and resulted in errors in unexpected places.
    
    The use case for this constructor is dubious. There were several tests
    in the code that would create an empty field, add it to a data set, then
    get it back out to pass to the worklet. The code is much simpler if you
    just make an ArrayHandle of the right type and use that in the worklet
    invoke directly. It is also faster to compile with smaller code because
    the type is known statically (whereas it is lost the other way).
    
    The other change was to declare references to ArrayHandle and
    DynamicArrayHandle as const. There is nothing in the behavior that
    invalidates the const, and it accepts arrays constructed in the
    parameter.
    f9750e83