summaryrefslogtreecommitdiffstats
path: root/llvm/include/llvm/ADT/STLExtras.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/ADT/STLExtras.h')
-rw-r--r--llvm/include/llvm/ADT/STLExtras.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 8e4d186d15a..eb515fd4583 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -208,9 +208,8 @@ inline mapped_iterator<ItTy, FuncTy> map_iterator(const ItTy &I, FuncTy F) {
return mapped_iterator<ItTy, FuncTy>(I, F);
}
-/// \brief Metafunction to determine if type T has a member called rbegin().
-template <typename Ty>
-class has_rbegin {
+/// Helper to determine if type T has a member called rbegin().
+template <typename Ty> class has_rbegin_impl {
typedef char yes[1];
typedef char no[2];
@@ -224,6 +223,11 @@ public:
static const bool value = sizeof(test<Ty>(nullptr)) == sizeof(yes);
};
+/// Metafunction to determine if T& or T has a member called rbegin().
+template <typename Ty>
+struct has_rbegin : has_rbegin_impl<typename std::remove_reference<Ty>::type> {
+};
+
// Returns an iterator_range over the given container which iterates in reverse.
// Note that the container must have rbegin()/rend() methods for this to work.
template <typename ContainerTy>
OpenPOWER on IntegriCloud