[PATCH] D67647: [Consumed] Refactor handleCall to take function argument list. NFC.

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 26 14:55:31 PDT 2019


dblaikie 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;
+}
+
----------------
comex wrote:
> 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.
Fair enough - thanks for the details :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67647





More information about the cfe-commits mailing list