Implement P0007: Constant View: A proposal for a std::as_const helper function template.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@253274 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/utility b/include/utility
index 8b982da..2975320 100644
--- a/include/utility
+++ b/include/utility
@@ -52,6 +52,9 @@
     >::type
     move_if_noexcept(T& x) noexcept; // constexpr in C++14
 
+template <class T> constexpr add_const<T>_t& as_const(T& t) noexcept;      // C++17
+template <class T>                      void as_const(const T&&) = delete; // C++17
+
 template <class T> typename add_rvalue_reference<T>::type declval() noexcept;
 
 template <class T1, class T2>
@@ -242,6 +245,11 @@
     return _VSTD::move(__x);
 }
 
+#if _LIBCPP_STD_VER > 14
+template <class _Tp> constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
+template <class _Tp>                        void as_const(const _Tp&&) = delete;
+#endif
+
 struct _LIBCPP_TYPE_VIS_ONLY piecewise_construct_t { };
 #if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY)
 extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();