Update <random> with constexpr support. Patch contributed by Jonathan Sauer.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153896 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2012-04-02 21:00:45 +00:00
parent 60cb7d267f
commit 8efd3dac5d
6 changed files with 130 additions and 100 deletions

View File

@@ -30,12 +30,14 @@ private:
static_assert(Min < Max, "rand1 invalid parameters");
public:
// Temporary work around for lack of constexpr
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
// Workaround for lack of constexpr in C++03
static const result_type _Min = Min;
static const result_type _Max = Max;
#endif
static const/*expr*/ result_type min() {return Min;}
static const/*expr*/ result_type max() {return Max;}
static _LIBCPP_CONSTEXPR result_type min() {return Min;}
static _LIBCPP_CONSTEXPR result_type max() {return Max;}
explicit rand1(result_type sd = Min) : x_(sd)
{