[PATCH] D23252: [ADT] Extra STLExtras

bryant via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 10:56:13 PDT 2016


bryant added inline comments.

================
Comment at: include/llvm/ADT/STLExtras.h:241-243
@@ +240,5 @@
+
+template <typename B, typename... Bs> constexpr bool all_true(B b, Bs... rest) {
+  return b && all_true(rest...);
+}
+
----------------
dblaikie wrote:
> Recursive implementations only used in constexpr contexts are fine - but a recursive implementation used in a non-constexpr context may still be implemented recursively by the compiler & is usually best avoided. (this is a problem with constexpr currently - where the ideal implementation for constexpr is not the same as the ideal implementation for non-constexpr contexts)
> 
> & this isn't being called in a constexpr context, so I'm not sure of the value of flagging it as constexpr or designing it in a way that would be valid constexpr.
can you find a case where `all_true` is codegened into a recursive call?


Repository:
  rL LLVM

https://reviews.llvm.org/D23252





More information about the llvm-commits mailing list