comex marked 2 inline comments as done.
comex added inline comments.

================
Comment at: llvm/include/llvm/ADT/iterator_range.h:27-33
+template <typename T>
+constexpr bool is_random_iterator() {
+  return std::is_same<
+    typename std::iterator_traits<T>::iterator_category,
+    std::random_access_iterator_tag>::value;
+}
+
----------------
dblaikie wrote:
> Is this how the C++ standard is doing things these days? Or is it usually 
> done with variable templates?
"Type trait"-like things have gone through three different evolutions:

- C++11 struct templates: `std::is_integral<T>::value`
- C++17 variable templates: `std::is_integral_v<T>`
- C++20 concepts: `std::integral<T>`

In fact, the C++20 draft has a `random_access_iterator<T>` concept, though 
there is no `is_random_access_iterator` in prior versions.

However, with LLVM still built as C++11, this helper has to be a struct 
template or a constexpr function.  It seemed a bit simpler to use a constexpr 
function, since template specialization wasn't needed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67647/new/

https://reviews.llvm.org/D67647



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to