[cfe-commits] [libcxx] r153856 - in /libcxx/trunk/include: __config algorithm random type_traits
Howard Hinnant
hhinnant at apple.com
Sun Apr 1 17:40:41 PDT 2012
Author: hhinnant
Date: Sun Apr 1 19:40:41 2012
New Revision: 153856
URL: http://llvm.org/viewvc/llvm-project?rev=153856&view=rev
Log:
This is an initial commit of constexpr support as proposed by Richard Smith. This by no means completes constexpr support. Indeed, it hardly scratches the surface. All it does is lay the foundation in <__config> and changes those few places in the library that are already using that foundation.
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/algorithm
libcxx/trunk/include/random
libcxx/trunk/include/type_traits
Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=153856&r1=153855&r2=153856&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Sun Apr 1 19:40:41 2012
@@ -384,7 +384,9 @@
#endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
-#define constexpr const
+#define _LIBCPP_CONSTEXPR
+#else
+#define _LIBCPP_CONSTEXPR constexpr
#endif
#ifndef __has_feature
Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=153856&r1=153855&r2=153856&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Sun Apr 1 19:40:41 2012
@@ -2712,8 +2712,8 @@
result_type operator()();
- static constexpr result_type min() {return _Min;}
- static constexpr result_type max() {return _Max;}
+ static _LIBCPP_CONSTEXPR result_type min() {return _Min;}
+ static _LIBCPP_CONSTEXPR result_type max() {return _Max;}
friend __rs_default __rs_get();
};
Modified: libcxx/trunk/include/random
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/random?rev=153856&r1=153855&r2=153856&view=diff
==============================================================================
--- libcxx/trunk/include/random (original)
+++ libcxx/trunk/include/random Sun Apr 1 19:40:41 2012
@@ -3374,9 +3374,9 @@
static const result_type _Max = 0xFFFFFFFFu;
_LIBCPP_INLINE_VISIBILITY
- static constexpr result_type min() { return _Min;}
+ static _LIBCPP_CONSTEXPR result_type min() { return _Min;}
_LIBCPP_INLINE_VISIBILITY
- static constexpr result_type max() { return _Max;}
+ static _LIBCPP_CONSTEXPR result_type max() { return _Max;}
// constructors
explicit random_device(const string& __token = "/dev/urandom");
Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=153856&r1=153855&r2=153856&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Sun Apr 1 19:40:41 2012
@@ -163,22 +163,15 @@
template <class _Tp, _Tp __v>
struct _LIBCPP_VISIBLE integral_constant
{
- static constexpr _Tp value = __v;
+ static _LIBCPP_CONSTEXPR const _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant type;
_LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
- constexpr
-#endif
- operator value_type()
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
- const
-#endif
- {return value;}
+ _LIBCPP_CONSTEXPR operator value_type() const {return value;}
};
template <class _Tp, _Tp __v>
-constexpr _Tp integral_constant<_Tp, __v>::value;
+_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
More information about the cfe-commits
mailing list