Page MenuHomePhabricator

Expose template parameters of endian specific types as class members
ClosedPublic

Authored by labath on Mar 5 2019, 8:15 AM.

Details

Summary

This allows generic code to query these parameters, and is a common
practice in a lot of other template classes. I'm mainly interested in
the ValueType paramemter here, but I've added others for symmetry.

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Mar 5 2019, 8:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2019, 8:15 AM
Herald added a subscriber: kristina. · View Herald Transcript

What's the use case?

The use case is being able to convert from a ulittle32_t (and friends) into an enum class. Since both are strongly typed, I cannot convert between one and the other without an intermediate cast to the basic type (and so, in generic code, I need to know what that type is). You can see it in action in D58976 (just search for value_type).

Bigcheese accepted this revision.Mar 5 2019, 2:52 PM

Ah, I see. This seems fine.

This revision is now accepted and ready to land.Mar 5 2019, 2:52 PM
This revision was automatically updated to reflect the committed changes.