The methods for constructing constant sequencish types (struct, array, vector) aren't
consistent and we are missing a few useful convenience methods. I would like to change
the interfaces to each support four construction methods:
(a) With and without a type.
(b) With a vector or an array + size.
Here:
The methods for constructing constant sequencish types (struct, array, vector) aren't
consistent and we are missing a few useful convenience methods. I would like to change
the interfaces to each support four construction methods:
(a) With and without a type.
What is the use of ConstantStruct without a type ?
(b) With a vector or an array + size.
[snip]
While I am at it it would make sense to make the array + size methods more
efficient (not construct a vector).
Why not ?
Any problems?
One suggestion, while you're here, add methods that use SmallVector (IMO removing methods that use std::vector is a good idea).
The methods for constructing constant sequencish types (struct, array, vector) aren't
consistent and we are missing a few useful convenience methods.
Very true.
I would like to change
the interfaces to each support four construction methods:
(a) With and without a type.
(b) With a vector or an array + size.
I'd strongly prefer to get rid of the versions of these that take a vector and just take "element pointer + numelements" ranges for sequential containers.
Adding versions that take small vectors and vectors and arrays all seem like overkill. std::vector is an internal implementation detail, exposing it through the API is badness.
The issue with the types is more subtle. In some cases (e.g. structs) the type is never needed, and should be removed (the vals/numvals/packed version of the ctor is all we should have). In other cases, e.g. ConstantArray, you need to pass in the type: otherwise you can't make an array of zero length, because you don't know the element type. ConstantVectors can never have length zero, so they should just have the Vals/NumVals version.
I really think we should remove the "convenience" methods and standardize on the ones that don't assume an input container.
-Chris