[llvm] r351009 - [Algorithm] Add make_const_ref corresponding to make_const_ptr

Stephen Kelly via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 12 07:23:30 PST 2019


Author: steveire
Date: Sat Jan 12 07:23:30 2019
New Revision: 351009

URL: http://llvm.org/viewvc/llvm-project?rev=351009&view=rev
Log:
[Algorithm] Add make_const_ref corresponding to make_const_ptr

Reviewers: aaron.ballman

Subscribers: dexonsmith, kristina, llvm-commits

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

Modified:
    llvm/trunk/include/llvm/ADT/STLExtras.h

Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=351009&r1=351008&r2=351009&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/STLExtras.h Sat Jan 12 07:23:30 2019
@@ -75,6 +75,12 @@ template <typename T> struct make_const_
   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>
 //===----------------------------------------------------------------------===//




More information about the llvm-commits mailing list