[PATCH] D23252: [ADT] Extra STLExtras
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 8 10:06:40 PDT 2016
dblaikie added a subscriber: dblaikie.
dblaikie added a comment.
Generally lacking test coverage, and could consider using std::begin/std::end rather than member begin/end to make sure these algorithms work with arrays and other things without member begin/end.
================
Comment at: include/llvm/ADT/STLExtras.h:238-259
@@ -237,1 +237,24 @@
+// NatList :: [Nat]
+template <unsigned... Ns> struct NatList {};
+
+template <typename L, typename R> struct Cons {};
+
+template <unsigned n, unsigned... m> struct Cons<NatList<n>, NatList<m...>> {
+ using eval = NatList<n, m...>;
+};
+
+template <unsigned n, typename T> struct Cons<NatList<n>, T> {
+ using eval = Cons<NatList<n>, typename T::eval>;
+};
+
+template <unsigned n, unsigned max> struct BuildNatList {
+ using eval =
+ typename Cons<NatList<n>, typename BuildNatList<n + 1, max>::eval>::eval;
+};
+
+template <unsigned max> struct BuildNatList<max, max> {
+ using eval = NatList<max>;
+};
+
+template <typename... Iters> class ZipFirst {
----------------
These look like implementation details (& arguably ZipFirst/ZipShortest/Zippy are implementation details too) that should be hidden from the llvm namespace (either as local/nested types or in a 'detail' namespace, etc).
Repository:
rL LLVM
https://reviews.llvm.org/D23252
More information about the llvm-commits
mailing list