Why are void[] contents marked as having pointers?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun May 31 14:00:45 PDT 2009
BCS wrote:
>> so use ubyte, insert a cast, and call it a day. If you have too
>> many casts, the problem is most likely elsewhere
>
> You might be correct, but I don't think any of us have enough info right
> now to make that assertion.
Oh there is enough information. What's needed is:
const(ubyte)[] getRepresentation(T)(T[] data)
{
return cast(typeof(return)) data;
}
If you have many calls to getRepresentation(), then that
anticlimatically shows that you need to look at arrays' representations
often. If there are too many of those, maybe some of the said arrays
should be dealt with as ubyte[] in the first place.
Andrei
More information about the Digitalmars-d
mailing list