summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/STLExtras.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-16 19:46:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-16 19:46:52 +0000
commit6b3f41ed88e8e440e11a4fbf20b6600529f80049 (patch)
tree928b056f24a634d628c80238dbbf10d41b1a71d5 /include/llvm/ADT/STLExtras.h
parentc46e6a5940c50058e00c0c5f9123fd82e338d29a (diff)
Notes
Diffstat (limited to 'include/llvm/ADT/STLExtras.h')
-rw-r--r--include/llvm/ADT/STLExtras.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h
index 15945adbe589a..8c28412bb6078 100644
--- a/include/llvm/ADT/STLExtras.h
+++ b/include/llvm/ADT/STLExtras.h
@@ -706,6 +706,18 @@ struct is_one_of<T, U, Ts...> {
std::is_same<T, U>::value || is_one_of<T, Ts...>::value;
};
+/// \brief traits class for checking whether type T is a base class for all
+/// the given types in the variadic list.
+template <typename T, typename... Ts> struct are_base_of {
+ static const bool value = true;
+};
+
+template <typename T, typename U, typename... Ts>
+struct are_base_of<T, U, Ts...> {
+ static const bool value =
+ std::is_base_of<T, U>::value && are_base_of<T, Ts...>::value;
+};
+
//===----------------------------------------------------------------------===//
// Extra additions for arrays
//===----------------------------------------------------------------------===//
@@ -1079,7 +1091,7 @@ private:
///
/// std::vector<char> Items = {'A', 'B', 'C', 'D'};
/// for (auto X : enumerate(Items)) {
-/// printf("Item %d - %c\n", X.Index, X.Value);
+/// printf("Item %d - %c\n", X.index(), X.value());
/// }
///
/// Output: