summaryrefslogtreecommitdiffstats
path: root/libcxx/include/string
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-12-16 18:23:39 -0500
committerEric Fiselier <eric@efcs.ca>2019-12-16 18:38:58 -0500
commit549545b64aab77d2a1784062451ee1c33f8324d2 (patch)
tree54085e795e52088e247d055f92782ad4e002d2e3 /libcxx/include/string
parentf63b64c0c3b486f164c3c66cce9f13df2bac6b6e (diff)
downloadbcm5719-llvm-549545b64aab77d2a1784062451ee1c33f8324d2.tar.gz
bcm5719-llvm-549545b64aab77d2a1784062451ee1c33f8324d2.zip
[libc++] Rework compressed pair constructors.
This patch de-duplicates most compressed pair constructors to use the same code in C++11 and C++03. Part of doing that is deleting the "__second_tag()" and replacing it with a "__value_init_tag()" which has the same effect, but allows for the removal of the special "one-arg" first element constructor. This patch is intended to have no semantic change.
Diffstat (limited to 'libcxx/include/string')
-rw-r--r--libcxx/include/string26
1 files changed, 13 insertions, 13 deletions
diff --git a/libcxx/include/string b/libcxx/include/string
index 4e0b21135a7..488c07a20cb 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1736,7 +1736,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
#else
_NOEXCEPT
#endif
-: __r_(__second_tag(), __a)
+: __r_(__value_init_tag(), __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@@ -1796,7 +1796,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
template <class _CharT, class _Traits, class _Allocator>
template <class>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
__init(__s, traits_type::length(__s));
@@ -1819,7 +1819,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
template <class _CharT, class _Traits, class _Allocator>
inline
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
__init(__s, __n);
@@ -1830,7 +1830,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
- : __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
+ : __r_(__value_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
{
if (!__str.__is_long())
__r_.first().__r = __str.__r_.first().__r;
@@ -1844,7 +1844,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(
const basic_string& __str, const allocator_type& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
if (!__str.__is_long())
__r_.first().__r = __str.__r_.first().__r;
@@ -1878,7 +1878,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
template <class _CharT, class _Traits, class _Allocator>
inline
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
__init(_VSTD::__to_address(__str.__get_long_pointer()), __str.__get_long_size());
@@ -1933,7 +1933,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
template <class _CharT, class _Traits, class _Allocator>
template <class>
basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
__init(__n, __c);
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1945,7 +1945,7 @@ template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
size_type __pos, size_type __n,
const _Allocator& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
size_type __str_sz = __str.size();
if (__pos > __str_sz)
@@ -1960,7 +1960,7 @@ template <class _CharT, class _Traits, class _Allocator>
inline
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
const _Allocator& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
size_type __str_sz = __str.size();
if (__pos > __str_sz)
@@ -1975,7 +1975,7 @@ template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, class>
basic_string<_CharT, _Traits, _Allocator>::basic_string(
const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
__self_view __sv0 = __t;
__self_view __sv = __sv0.substr(__pos, __n);
@@ -1999,7 +1999,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
template <class _CharT, class _Traits, class _Allocator>
template <class _Tp, class>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
__self_view __sv = __t;
__init(__sv.data(), __sv.size());
@@ -2082,7 +2082,7 @@ template<class _InputIterator, class>
inline
basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
__init(__first, __last);
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -2108,7 +2108,7 @@ inline
basic_string<_CharT, _Traits, _Allocator>::basic_string(
initializer_list<_CharT> __il, const _Allocator& __a)
- : __r_(__second_tag(), __a)
+ : __r_(__value_init_tag(), __a)
{
__init(__il.begin(), __il.end());
#if _LIBCPP_DEBUG_LEVEL >= 2
OpenPOWER on IntegriCloud