]> granicus.if.org Git - llvm/commitdiff
[Algorithm] Add make_const_ref corresponding to make_const_ptr
authorStephen Kelly <steveire@gmail.com>
Sat, 12 Jan 2019 15:23:30 +0000 (15:23 +0000)
committerStephen Kelly <steveire@gmail.com>
Sat, 12 Jan 2019 15:23:30 +0000 (15:23 +0000)
Reviewers: aaron.ballman

Subscribers: dexonsmith, kristina, llvm-commits

Differential Revision: https://reviews.llvm.org/D56622

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351009 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/STLExtras.h

index 8685f0e4aada7f1372afb56d54aed2e0da56cc41..f66ca7c08a73ffef39d2238585619a9984adcbd0 100644 (file)
@@ -75,6 +75,12 @@ template <typename T> struct make_const_ptr {
   using type =
       typename std::add_pointer<typename std::add_const<T>::type>::type;
 };
+
+template <typename T> struct make_const_ref {
+  using type = typename std::add_lvalue_reference<
+      typename std::add_const<T>::type>::type;
+};
+
 //===----------------------------------------------------------------------===//
 //     Extra additions to <functional>
 //===----------------------------------------------------------------------===//