[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

llvm-svn: 351009

llvm/include/llvm/ADT/STLExtras.h

index 8685f0e..f66ca7c 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>
 //===----------------------------------------------------------------------===//