constexpr support for <utility>. Patch contributed by Jonathan Sauer.

llvm-svn: 153968
This commit is contained in:
Howard Hinnant
2012-04-03 21:09:48 +00:00
parent 13668f2083
commit b2e9f19caf
2 changed files with 7 additions and 2 deletions

View File

@@ -206,8 +206,11 @@ move_if_noexcept(_Tp& __x) _NOEXCEPT
}
struct _LIBCPP_VISIBLE piecewise_construct_t { };
//constexpr
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
#else
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
#endif
template <class _T1, class _T2>
struct _LIBCPP_VISIBLE pair
@@ -221,7 +224,7 @@ struct _LIBCPP_VISIBLE pair
// pair(const pair&) = default;
// pair(pair&&) = default;
_LIBCPP_INLINE_VISIBILITY pair() : first(), second() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
_LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
: first(__x), second(__y) {}

View File

@@ -11,6 +11,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
const piecewise_construct_t piecewise_construct = {};
#endif
_LIBCPP_END_NAMESPACE_STD