[cfe-dev] [PATCH] Libc++ Windows fixes
Ruben Van Boxem
vanboxem.ruben at gmail.com
Fri Dec 2 14:13:11 PST 2011
2011/12/2 Howard Hinnant <hhinnant at apple.com>
> Was this intended to be a patch for libc++? It looks like maybe the wrong
> patch file got attached.
>
My apologies, I got mixed up with a winpthreads patch.
I'll repeat the shortlist:
- <type_traits>: MSVC 10 and 11 has a messed up decltype (which fails on
dependant types in templates). I added _LIBCPP_HAS_BROKEN_DECLTYPE which
removes the problematic code (which includes common_type and
is_constructible, and everything that uses is_constructible).
- <type_traits>: I added MSVC intrinsics for available type_traits, and
moved __is_construct outside the already present ifdef's to assure it's
availability necessary for later. The type_traits could maybe do with a
__config macro, but they're not quite homogeneous across compilers, and
this would lead to 3-4 macros controlling what code should be used to
maintain consistency, which kind of sucks.
- <memory>: MSVC chokes on the "class = enable_if<....>" template
constructs. I removed the "class =" bit, and the code compiles, but I'm
unsure if this keeps the intended behavior.
- <memory>, <__split_buffer>, <vector>, <string>: MSVC fails to resolve
the correct overloads (see my previous mail, obviously a compiler bug), but
this is easily solved by moving the function definition into the class
definition above (instead of after).
- locale_win32.h: rename __restrict__ to __restrict, which works for both
MSVC and MinGW.
I apologize for the size, but there's a lot of the same stuff, or
cut-pasted code.
Upcoming changes I can predict: more overload resolution failures, so
moving function definitions into the class definitions, and some "__except"
variables that need to be renamed (conflicting MSVC keyword). Also:
"extern" on templates gives errors when they're later defined, I'm not sure
how to solve this. MSVC does not support C++11 "extern templates" :(
Thanks,
Ruben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111202/7f685506/attachment.html>
-------------- next part --------------
Index: include/utility
===================================================================
--- include/utility (revision 145708)
+++ include/utility (working copy)
@@ -190,7 +190,7 @@
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_BROKEN_DECLTYPE)
typename conditional
<
!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value,
@@ -229,7 +229,7 @@
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_BROKEN_DECLTYPE)
,typename enable_if<is_constructible<_T1, _U1>::value &&
is_constructible<_T2, _U2>::value>::type* = 0
#endif
@@ -255,7 +255,7 @@
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_BROKEN_DECLTYPE)
template <class _U1, class _U2,
class = typename enable_if<is_constructible<first_type, _U1 >::value &&
Index: include/type_traits
===================================================================
--- include/type_traits (revision 145708)
+++ include/type_traits (working copy)
@@ -1178,6 +1178,7 @@
// is_assignable
+#ifndef _LIBCPP_HAS_BROKEN_DECLTYPE
template <class _Tp, class _Arg>
decltype((_VSTD::declval<_Tp>() = _VSTD::declval<_Arg>(), true_type()))
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1260,7 +1261,7 @@
template <class _Tp>
struct is_destructible
: public __destructible_imp<_Tp> {};
-
+#endif
// move
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1865,6 +1866,15 @@
#endif // _LIBCPP_HAS_NO_VARIADICS
+namespace __is_construct
+{
+
+struct __nat {};
+
+}
+
+#ifndef _LIBCPP_HAS_BROKEN_DECLTYPE
+
#ifndef _LIBCPP_HAS_NO_VARIADICS
// template <class T, class... Args> struct is_constructible;
@@ -2096,13 +2106,6 @@
// is_constructible entry point
-namespace __is_construct
-{
-
-struct __nat {};
-
-}
-
template <class _Tp, class _A0 = __is_construct::__nat,
class _A1 = __is_construct::__nat>
struct _LIBCPP_VISIBLE is_constructible
@@ -2193,6 +2196,8 @@
#endif
{};
+#endif // _LIBCPP_HAS_BROKEN_DECLTYPE
+
// is_trivially_constructible
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2205,7 +2210,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp>
-#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_constructor) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_constructor(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2219,7 +2226,9 @@
#else
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp>
#endif
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2229,7 +2238,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2239,7 +2250,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2259,7 +2272,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
__is_construct::__nat>
-#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_constructor) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_constructor(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2270,7 +2285,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
__is_construct::__nat>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2281,7 +2298,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
__is_construct::__nat>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2292,7 +2311,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
__is_construct::__nat>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2332,7 +2353,9 @@
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp>
-#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_assign) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -2340,7 +2363,9 @@
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&>
-#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_assign) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -2348,7 +2373,9 @@
template <class _Tp>
struct is_trivially_assignable<_Tp&, const _Tp&>
-#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_assign) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -2358,7 +2385,9 @@
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&&>
-#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_assign) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_trivial_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -2386,7 +2415,9 @@
// is_trivially_destructible
-#if __has_feature(has_trivial_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_trivial_destructor) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_destructible
: public integral_constant<bool, __has_trivial_destructor(_Tp)> {};
@@ -2444,7 +2475,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp>
-#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_constructor) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_constructor(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2458,7 +2491,9 @@
#else
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp>
#endif
-#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2468,7 +2503,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&>
-#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2478,7 +2515,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&>
-#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2500,7 +2539,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, __is_construct::__nat,
__is_construct::__nat>
-#if __has_feature(has_nothrow_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_constructor) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_constructor(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2511,7 +2552,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp,
__is_construct::__nat>
-#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2522,7 +2565,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, const _Tp&,
__is_construct::__nat>
-#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2533,7 +2578,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_constructible<_Tp, _Tp&,
__is_construct::__nat>
-#if __has_feature(has_nothrow_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_copy) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_copy(_Tp)>
#else
: integral_constant<bool, is_scalar<_Tp>::value>
@@ -2597,7 +2644,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp>
-#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_assign) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -2605,7 +2654,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, _Tp&>
-#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_assign) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -2613,7 +2664,9 @@
template <class _Tp>
struct _LIBCPP_VISIBLE is_nothrow_assignable<_Tp&, const _Tp&>
-#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_assign) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -2623,7 +2676,9 @@
template <class _Tp>
struct is_nothrow_assignable<_Tp&, _Tp&&>
-#if __has_feature(has_nothrow_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(has_nothrow_assign) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
: integral_constant<bool, __has_nothrow_assign(_Tp)> {};
#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
@@ -2710,7 +2765,9 @@
// is_pod
-#if __has_feature(is_pod) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
+#if __has_feature(is_pod) \
+ || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) \
+ || defined(_MSC_VER)
template <class _Tp> struct _LIBCPP_VISIBLE is_pod
: public integral_constant<bool, __is_pod(_Tp)> {};
@@ -2741,6 +2798,8 @@
template <class _Tp> struct _LIBCPP_VISIBLE is_standard_layout
#if __has_feature(is_standard_layout)
: public integral_constant<bool, __is_standard_layout(_Tp)>
+#elif defined(_MSC_VER)
+ : public integral_constant<bool, __is_pod(_Tp)>
#else
: integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
#endif
@@ -2761,6 +2820,8 @@
template <class _Tp> struct _LIBCPP_VISIBLE is_trivial
#if __has_feature(is_trivial)
: public integral_constant<bool, __is_trivial(_Tp)>
+#elif defined(_MSC_VER)
+ : public integral_constant<bool, __is_pod(_Tp)>
#else
: integral_constant<bool, is_trivially_copyable<_Tp>::value &&
is_trivially_default_constructible<_Tp>::value>
@@ -2985,7 +3046,7 @@
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
+#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_BROKEN_DECLTYPE)
typename enable_if
<
is_move_constructible<_Tp>::value &&
Index: include/memory
===================================================================
--- include/memory (revision 145708)
+++ include/memory (working copy)
@@ -2518,7 +2518,7 @@
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Pp,
- class = typename enable_if<is_same<_Pp, pointer>::value>::type
+ typename enable_if<is_same<_Pp, pointer>::value>::type
>
_LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p) _NOEXCEPT
: __ptr_(__p)
@@ -2528,7 +2528,7 @@
}
template <class _Pp,
- class = typename enable_if<is_same<_Pp, pointer>::value>::type
+ typename enable_if<is_same<_Pp, pointer>::value>::type
>
_LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename conditional<
is_reference<deleter_type>::value,
@@ -2545,8 +2545,8 @@
: __ptr_(pointer(), __d) {}
template <class _Pp,
- class = typename enable_if<is_same<_Pp, pointer>::value ||
- is_same<_Pp, nullptr_t>::value>::type
+ typename enable_if<is_same<_Pp, pointer>::value ||
+ is_same<_Pp, nullptr_t>::value>::type
>
_LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename remove_reference<deleter_type>::type&& __d)
_NOEXCEPT
@@ -2629,7 +2629,7 @@
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Pp,
- class = typename enable_if<is_same<_Pp, pointer>::value>::type
+ typename enable_if<is_same<_Pp, pointer>::value>::type
>
_LIBCPP_INLINE_VISIBILITY void reset(_Pp __p) _NOEXCEPT
{
@@ -3067,7 +3067,14 @@
template <class _Yp, class _Dp> shared_ptr(const unique_ptr<_Yp, _Dp>& __r);// = delete;
public:
template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>&&,
- typename enable_if<!is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
+ typename enable_if<!is_lvalue_reference<_Dp>::value, __nat>::type = __nat())
+ : __ptr_(__r.get())
+{
+ typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
+ __enable_weak_this(__r.get());
+ __r.release();
+}
template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>&&,
typename enable_if<is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -3393,13 +3400,10 @@
__r.release();
}
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
template <class _Yp, class _Dp>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,
-#else
shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
-#endif
typename enable_if<!is_lvalue_reference<_Dp>::value, __nat>::type)
: __ptr_(__r.get())
{
@@ -3408,6 +3412,7 @@
__enable_weak_this(__r.get());
__r.release();
}
+#endif
template<class _Tp>
template <class _Yp, class _Dp>
Index: include/__split_buffer
===================================================================
--- include/__split_buffer (revision 145708)
+++ include/__split_buffer (working copy)
@@ -117,7 +117,25 @@
!__is_forward_iterator<_InputIter>::value,
void
>::type
- __construct_at_end(_InputIter __first, _InputIter __last);
+ __construct_at_end(_InputIter __first, _InputIter __last)
+ {
+ __alloc_rr& __a = this->__alloc();
+ for (; __first != __last; ++__first)
+ {
+ if (__end_ == __end_cap())
+ {
+ size_type __old_cap = __end_cap() - __first_;
+ size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
+ __split_buffer __buf(__new_cap, 0, __a);
+ for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
+ __alloc_traits::construct(__buf.__alloc(),
+ _VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
+ swap(__buf);
+ }
+ __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
+ ++this->__end_;
+ }
+ }
template <class _ForwardIterator>
typename enable_if
<
@@ -238,34 +256,6 @@
}
template <class _Tp, class _Allocator>
-template <class _InputIter>
-typename enable_if
-<
- __is_input_iterator<_InputIter>::value &&
- !__is_forward_iterator<_InputIter>::value,
- void
->::type
-__split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIter __last)
-{
- __alloc_rr& __a = this->__alloc();
- for (; __first != __last; ++__first)
- {
- if (__end_ == __end_cap())
- {
- size_type __old_cap = __end_cap() - __first_;
- size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
- __split_buffer __buf(__new_cap, 0, __a);
- for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
- __alloc_traits::construct(__buf.__alloc(),
- _VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
- swap(__buf);
- }
- __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
- ++this->__end_;
- }
-}
-
-template <class _Tp, class _Allocator>
template <class _ForwardIterator>
typename enable_if
<
Index: include/string
===================================================================
--- include/string (revision 145708)
+++ include/string (working copy)
@@ -1272,7 +1272,12 @@
!__is_forward_iterator<_InputIterator>::value,
basic_string&
>::type
- append(_InputIterator __first, _InputIterator __last);
+ append(_InputIterator __first, _InputIterator __last)
+ {
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ return *this;
+ }
template<class _ForwardIterator>
typename enable_if
<
@@ -1311,7 +1316,12 @@
!__is_forward_iterator<_InputIterator>::value,
basic_string&
>::type
- assign(_InputIterator __first, _InputIterator __last);
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ clear();
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
template<class _ForwardIterator>
typename enable_if
<
@@ -1340,7 +1350,16 @@
!__is_forward_iterator<_InputIterator>::value,
iterator
>::type
- insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
+ insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
+ {
+ size_type __old_sz = size();
+ difference_type __ip = __pos - begin();
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ pointer __p = __get_pointer();
+ _VSTD::rotate(__p + __ip, __p + __old_sz, __p + size());
+ return iterator(__p + __ip);
+ }
template<class _ForwardIterator>
typename enable_if
<
@@ -1555,7 +1574,25 @@
!__is_forward_iterator<_InputIterator>::value,
void
>::type
- __init(_InputIterator __first, _InputIterator __last);
+ __init(_InputIterator __first, _InputIterator __last)
+ {
+ __zero();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ if (__is_long())
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
template <class _ForwardIterator>
typename enable_if
@@ -1916,34 +1953,6 @@
}
template <class _CharT, class _Traits, class _Allocator>
-template <class _InputIterator>
-typename enable_if
-<
- __is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value,
- void
->::type
-basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
-{
- __zero();
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (; __first != __last; ++__first)
- push_back(*__first);
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- if (__is_long())
- __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
-}
-
-template <class _CharT, class _Traits, class _Allocator>
template <class _ForwardIterator>
typename enable_if
<
@@ -2194,21 +2203,6 @@
#endif
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator>
-typename enable_if
-<
- __is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value,
- basic_string<_CharT, _Traits, _Allocator>&
->::type
-basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
- clear();
- for (; __first != __last; ++__first)
- push_back(*__first);
-}
-
-template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
typename enable_if
<
@@ -2323,21 +2317,6 @@
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator>
-typename enable_if
-<
- __is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value,
- basic_string<_CharT, _Traits, _Allocator>&
->::type
-basic_string<_CharT, _Traits, _Allocator>::append(_InputIterator __first, _InputIterator __last)
-{
- for (; __first != __last; ++__first)
- push_back(*__first);
- return *this;
-}
-
-template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
typename enable_if
<
@@ -2458,25 +2437,6 @@
}
template <class _CharT, class _Traits, class _Allocator>
-template<class _InputIterator>
-typename enable_if
-<
- __is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value,
- typename basic_string<_CharT, _Traits, _Allocator>::iterator
->::type
-basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
-{
- size_type __old_sz = size();
- difference_type __ip = __pos - begin();
- for (; __first != __last; ++__first)
- push_back(*__first);
- pointer __p = __get_pointer();
- _VSTD::rotate(__p + __ip, __p + __old_sz, __p + size());
- return iterator(__p + __ip);
-}
-
-template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
typename enable_if
<
Index: include/vector
===================================================================
--- include/vector (revision 145708)
+++ include/vector (working copy)
@@ -523,11 +523,26 @@
template <class _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value>::type* = 0);
+ !__is_forward_iterator<_InputIterator>::value>::type* = 0)
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_c(this);
+#endif
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
template <class _InputIterator>
vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value>::type* = 0);
+ !__is_forward_iterator<_InputIterator>::value>::type* = 0)
+ : __base(__a)
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ __get_db()->__insert_c(this);
+#endif
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
template <class _ForwardIterator>
vector(_ForwardIterator __first, _ForwardIterator __last,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
@@ -577,7 +592,12 @@
!__is_forward_iterator<_InputIterator>::value,
void
>::type
- assign(_InputIterator __first, _InputIterator __last);
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ clear();
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
template <class _ForwardIterator>
typename enable_if
<
@@ -700,7 +720,50 @@
!__is_forward_iterator<_InputIterator>::value,
iterator
>::type
- insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
+ insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
+ {
+#if _LIBCPP_DEBUG_LEVEL >= 2
+ _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
+ "vector::insert(iterator, range) called with an iterator not"
+ " referring to this vector");
+#endif
+ difference_type __off = __position - begin();
+ pointer __p = this->__begin_ + __off;
+ allocator_type& __a = this->__alloc();
+ pointer __old_last = this->__end_;
+ for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
+ {
+ __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
+ *__first);
+ ++this->__end_;
+ }
+ __split_buffer<value_type, allocator_type&> __v(__a);
+ if (__first != __last)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ __v.__construct_at_end(__first, __last);
+ difference_type __old_size = __old_last - this->__begin_;
+ difference_type __old_p = __p - this->__begin_;
+ reserve(__recommend(size() + __v.size()));
+ __p = this->__begin_ + __old_p;
+ __old_last = this->__begin_ + __old_size;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ erase(__make_iter(__old_last), end());
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ __p = _VSTD::rotate(__p, __old_last, this->__end_);
+ insert(__make_iter(__p), make_move_iterator(__v.begin()),
+ make_move_iterator(__v.end()));
+ return begin() + __off;
+ }
template <class _ForwardIterator>
typename enable_if
<
@@ -708,6 +771,7 @@
iterator
>::type
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
+
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __position, initializer_list<value_type> __il)
@@ -1019,33 +1083,6 @@
}
template <class _Tp, class _Allocator>
-template <class _InputIterator>
-vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
- typename enable_if<__is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value>::type*)
-{
-#if _LIBCPP_DEBUG_LEVEL >= 2
- __get_db()->__insert_c(this);
-#endif
- for (; __first != __last; ++__first)
- push_back(*__first);
-}
-
-template <class _Tp, class _Allocator>
-template <class _InputIterator>
-vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
- typename enable_if<__is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value>::type*)
- : __base(__a)
-{
-#if _LIBCPP_DEBUG_LEVEL >= 2
- __get_db()->__insert_c(this);
-#endif
- for (; __first != __last; ++__first)
- push_back(*__first);
-}
-
-template <class _Tp, class _Allocator>
template <class _ForwardIterator>
vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
@@ -1242,21 +1279,6 @@
}
template <class _Tp, class _Allocator>
-template <class _InputIterator>
-typename enable_if
-<
- __is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value,
- void
->::type
-vector<_Tp, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
- clear();
- for (; __first != __last; ++__first)
- push_back(*__first);
-}
-
-template <class _Tp, class _Allocator>
template <class _ForwardIterator>
typename enable_if
<
@@ -1716,59 +1738,6 @@
}
template <class _Tp, class _Allocator>
-template <class _InputIterator>
-typename enable_if
-<
- __is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value,
- typename vector<_Tp, _Allocator>::iterator
->::type
-vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
-{
-#if _LIBCPP_DEBUG_LEVEL >= 2
- _LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
- "vector::insert(iterator, range) called with an iterator not"
- " referring to this vector");
-#endif
- difference_type __off = __position - begin();
- pointer __p = this->__begin_ + __off;
- allocator_type& __a = this->__alloc();
- pointer __old_last = this->__end_;
- for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
- {
- __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
- *__first);
- ++this->__end_;
- }
- __split_buffer<value_type, allocator_type&> __v(__a);
- if (__first != __last)
- {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- __v.__construct_at_end(__first, __last);
- difference_type __old_size = __old_last - this->__begin_;
- difference_type __old_p = __p - this->__begin_;
- reserve(__recommend(size() + __v.size()));
- __p = this->__begin_ + __old_p;
- __old_last = this->__begin_ + __old_size;
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- erase(__make_iter(__old_last), end());
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
- }
- __p = _VSTD::rotate(__p, __old_last, this->__end_);
- insert(__make_iter(__p), make_move_iterator(__v.begin()),
- make_move_iterator(__v.end()));
- return begin() + __off;
-}
-
-template <class _Tp, class _Allocator>
template <class _ForwardIterator>
typename enable_if
<
@@ -2019,11 +1988,53 @@
template <class _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value>::type* = 0);
+ !__is_forward_iterator<_InputIterator>::value>::type* = 0)
+ : __begin_(0),
+ __size_(0),
+ __cap_alloc_(0)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ if (__begin_ != 0)
+ __storage_traits::deallocate(__alloc(), __begin_, __cap());
+ __invalidate_all_iterators();
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
template <class _InputIterator>
vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value>::type* = 0);
+ !__is_forward_iterator<_InputIterator>::value>::type* = 0)
+ : __begin_(0),
+ __size_(0),
+ __cap_alloc_(0, static_cast<__storage_allocator>(__a))
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ if (__begin_ != 0)
+ __storage_traits::deallocate(__alloc(), __begin_, __cap());
+ __invalidate_all_iterators();
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
template <class _ForwardIterator>
vector(_ForwardIterator __first, _ForwardIterator __last,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
@@ -2063,7 +2074,12 @@
!__is_forward_iterator<_InputIterator>::value,
void
>::type
- assign(_InputIterator __first, _InputIterator __last);
+ assign(_InputIterator __first, _InputIterator __last)
+ {
+ clear();
+ for (; __first != __last; ++__first)
+ push_back(*__first);
+ }
template <class _ForwardIterator>
typename enable_if
<
@@ -2157,7 +2173,42 @@
!__is_forward_iterator<_InputIterator>::value,
iterator
>::type
- insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
+ insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
+ {
+ difference_type __off = __position - begin();
+ iterator __p = __const_iterator_cast(__position);
+ iterator __old_end = end();
+ for (; size() != capacity() && __first != __last; ++__first)
+ {
+ ++this->__size_;
+ back() = *__first;
+ }
+ vector __v(__alloc());
+ if (__first != __last)
+ {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ __v.assign(__first, __last);
+ difference_type __old_size = static_cast<difference_type>(__old_end - begin());
+ difference_type __old_p = __p - begin();
+ reserve(__recommend(size() + __v.size()));
+ __p = begin() + __old_p;
+ __old_end = begin() + __old_size;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ erase(__old_end, end());
+ throw;
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+ }
+ __p = _VSTD::rotate(__p, __old_end, end());
+ insert(__p, __v.begin(), __v.end());
+ return begin() + __off;
+ }
template <class _ForwardIterator>
typename enable_if
<
@@ -2454,60 +2505,6 @@
}
template <class _Allocator>
-template <class _InputIterator>
-vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
- typename enable_if<__is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value>::type*)
- : __begin_(0),
- __size_(0),
- __cap_alloc_(0)
-{
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (; __first != __last; ++__first)
- push_back(*__first);
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- if (__begin_ != 0)
- __storage_traits::deallocate(__alloc(), __begin_, __cap());
- __invalidate_all_iterators();
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
-}
-
-template <class _Allocator>
-template <class _InputIterator>
-vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
- typename enable_if<__is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value>::type*)
- : __begin_(0),
- __size_(0),
- __cap_alloc_(0, static_cast<__storage_allocator>(__a))
-{
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- for (; __first != __last; ++__first)
- push_back(*__first);
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- if (__begin_ != 0)
- __storage_traits::deallocate(__alloc(), __begin_, __cap());
- __invalidate_all_iterators();
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
-}
-
-template <class _Allocator>
template <class _ForwardIterator>
vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
@@ -2724,21 +2721,6 @@
}
template <class _Allocator>
-template <class _InputIterator>
-typename enable_if
-<
- __is_input_iterator<_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value,
- void
->::type
-vector<bool, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
-{
- clear();
- for (; __first != __last; ++__first)
- push_back(*__first);
-}
-
-template <class _Allocator>
template <class _ForwardIterator>
typename enable_if
<
@@ -2874,51 +2856,6 @@
}
template <class _Allocator>
-template <class _InputIterator>
-typename enable_if
-<
- __is_input_iterator <_InputIterator>::value &&
- !__is_forward_iterator<_InputIterator>::value,
- typename vector<bool, _Allocator>::iterator
->::type
-vector<bool, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
-{
- difference_type __off = __position - begin();
- iterator __p = __const_iterator_cast(__position);
- iterator __old_end = end();
- for (; size() != capacity() && __first != __last; ++__first)
- {
- ++this->__size_;
- back() = *__first;
- }
- vector __v(__alloc());
- if (__first != __last)
- {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- __v.assign(__first, __last);
- difference_type __old_size = static_cast<difference_type>(__old_end - begin());
- difference_type __old_p = __p - begin();
- reserve(__recommend(size() + __v.size()));
- __p = begin() + __old_p;
- __old_end = begin() + __old_size;
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- erase(__old_end, end());
- throw;
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
- }
- __p = _VSTD::rotate(__p, __old_end, end());
- insert(__p, __v.begin(), __v.end());
- return begin() + __off;
-}
-
-template <class _Allocator>
template <class _ForwardIterator>
typename enable_if
<
Index: include/__config
===================================================================
--- include/__config (revision 145708)
+++ include/__config (working copy)
@@ -335,6 +335,7 @@
#define _ATTRIBUTE __declspec
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
+#define _LIBCPP_HAS_BROKEN_DECLTYPE
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
Index: include/support/win32/locale_win32.h
===================================================================
--- include/support/win32/locale_win32.h (revision 145708)
+++ include/support/win32/locale_win32.h (working copy)
@@ -35,18 +35,18 @@
locale_t newlocale( int mask, const char * locale, locale_t base );
locale_t uselocale( locale_t newloc );
lconv *localeconv_l( locale_t loc );
-size_t mbrlen_l( const char *__restrict__ s, size_t n,
- mbstate_t *__restrict__ ps, locale_t loc);
-size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
- size_t len, mbstate_t *__restrict__ ps, locale_t loc );
-size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps,
+size_t mbrlen_l( const char *__restrict s, size_t n,
+ mbstate_t *__restrict ps, locale_t loc);
+size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,
+ size_t len, mbstate_t *__restrict ps, locale_t loc );
+size_t wcrtomb_l( char *__restrict s, wchar_t wc, mbstate_t *__restrict ps,
locale_t loc);
-size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s,
- size_t n, mbstate_t *__restrict__ ps, locale_t loc);
-size_t mbsnrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
- size_t nms, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
-size_t wcsnrtombs_l( char *__restrict__ dst, const wchar_t **__restrict__ src,
- size_t nwc, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
+size_t mbrtowc_l( wchar_t *__restrict pwc, const char *__restrict s,
+ size_t n, mbstate_t *__restrict ps, locale_t loc);
+size_t mbsnrtowcs_l( wchar_t *__restrict dst, const char **__restrict src,
+ size_t nms, size_t len, mbstate_t *__restrict ps, locale_t loc);
+size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src,
+ size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc);
wint_t btowc_l( int c, locale_t loc );
int wctob_l( wint_t c, locale_t loc );
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
More information about the cfe-dev
mailing list