Deduplicating types in a list #151
-
We're looking at using Metal to replace an in-house type list implementation and one of the features that we use is to deduplicate types in a list. Looking at |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @spayne-pgh, glad to hear you're considering Metal. An implementation of template<class seq>
using unique = accumulate<bind<lambda<if_>, lambda<contains>, _1, lambda<append>>, list<>, seq>; You can try it live on compiler explorer, is that what you were looking for? |
Beta Was this translation helpful? Give feedback.
Hey @spayne-pgh, glad to hear you're considering Metal. An implementation of
unique
is not currently available out of the box, but can be easily implemented out of the primitives Metal offers, in fact it's a short one-liner:You can try it live on compiler explorer, is that what you were looking for?