diff --git a/include/string b/include/string index f7eba7dee..31ad307e5 100644 --- a/include/string +++ b/include/string @@ -956,9 +956,11 @@ public: void resize(size_type __n, value_type __c); _LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());} + void reserve(size_type __res_arg); _LIBCPP_INLINE_VISIBILITY void __resize_default_init(size_type __n); - void reserve(size_type __res_arg = 0); + _LIBCPP_INLINE_VISIBILITY + void reserve() _NOEXCEPT {reserve(0);} _LIBCPP_INLINE_VISIBILITY void shrink_to_fit() _NOEXCEPT {reserve();} _LIBCPP_INLINE_VISIBILITY diff --git a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp index 7210152ea..8b9dc13db 100644 --- a/test/std/strings/basic.string/string.capacity/reserve.pass.cpp +++ b/test/std/strings/basic.string/string.capacity/reserve.pass.cpp @@ -9,7 +9,9 @@ // -// void reserve(size_type res_arg=0); +// Split into two calls for C++20 +// void reserve(); +// void reserve(size_type res_arg); #include #include @@ -44,6 +46,9 @@ test(S s, typename S::size_type res_arg) assert(s == s0); assert(s.capacity() >= res_arg); assert(s.capacity() >= s.size()); +#if TEST_STD_VER > 17 + assert(s.capacity() >= old_cap); // resize never shrinks as of P0966 +#endif } #ifndef TEST_HAS_NO_EXCEPTIONS else @@ -90,6 +95,7 @@ int main() test(s, 10); test(s, 50); test(s, 100); + test(s, 1000); test(s, S::npos); } } @@ -121,6 +127,7 @@ int main() test(s, 10); test(s, 50); test(s, 100); + test(s, 1000); test(s, S::npos); } } diff --git a/www/cxx2a_status.html b/www/cxx2a_status.html index 090f3cb9e..5b090a088 100644 --- a/www/cxx2a_status.html +++ b/www/cxx2a_status.html @@ -80,7 +80,7 @@ P0809R0LWGComparing Unordered ContainersJacksonville P0858R0LWGConstexpr iterator requirementsJacksonville P0905R1CWGSymmetry for spaceshipJacksonville - P0966R1LWGstring::reserve Should Not ShrinkJacksonville + P0966R1LWGstring::reserve Should Not ShrinkJacksonvilleComplete8.0 P0019R8LWGAtomic RefRapperswil @@ -291,7 +291,7 @@ -

Last Updated: 27-Nov-2018

+

Last Updated: 28-Nov-2018