2
0
mirror of https://github.com/boostorg/json.git synced 2026-02-13 00:22:21 +00:00
This commit is contained in:
Vinnie Falco
2019-11-17 12:03:30 -08:00
parent e0b3ca5f0d
commit 6dc6e4b6e7
10 changed files with 82 additions and 36 deletions

View File

@@ -1640,10 +1640,19 @@ private:
@par Preconditions
`&lhs != &rhs`
@par Complexity
@param lhs The array to swap.
Constant or linear in `lhs.size() + rhs.size()`.
@param rhs The array to swap.
@par Exception Safety
Strong guarantee.
Calls to @ref storage::allocate may throw.
@param lhs The array to exchange.
@param rhs The array to exchange.
*/
inline
void

View File

@@ -102,7 +102,11 @@ public:
std::random_access_iterator_tag)
: string_impl(last - first, sp)
{
#ifdef _MSC_VER
std::copy(first, last, data());
#else
std::copy(first, last, data(), data() + size());
#endif
}
template<class InputIt>

View File

@@ -438,12 +438,12 @@ void
array::
swap(array& other)
{
BOOST_JSON_ASSERT(this != &other);
if(*sp_ == *other.sp_)
{
impl_.swap(other.impl_);
return;
}
array temp1(
std::move(*this),
other.storage());

View File

@@ -272,6 +272,7 @@ void
object::
swap(object& other)
{
BOOST_JSON_ASSERT(this != &other);
if(*sp_ == *other.sp_)
{
impl_.swap(other.impl_);

View File

@@ -284,12 +284,12 @@ void
string::
swap(string& other)
{
BOOST_JSON_ASSERT(this != &other);
if(*sp_ == *other.sp_)
{
std::swap(impl_, other.impl_);
return;
}
string temp1(
std::move(*this), other.sp_);
string temp2(
@@ -323,14 +323,6 @@ reserve_impl(size_type new_cap)
}
}
//----------------------------------------------------------
std::ostream&
operator<<(std::ostream& os, string const& s)
{
return os << static_cast<string_view>(s);
}
} // json
} // boost

View File

@@ -1406,10 +1406,19 @@ private:
@par Preconditions
`&lhs != &rhs`
@par Complexity
@param lhs The array to swap.
Constant or linear in `lhs.size() + rhs.size()`.
@param rhs The array to swap.
@par Exception Safety
Strong guarantee.
Calls to @ref storage::allocate may throw.
@param lhs The object to exchange.
@param rhs The object to exchange.
*/
inline
void

View File

@@ -2556,17 +2556,6 @@ public:
return string_view(*this).find_last_not_of(t, pos);
}
//------------------------------------------------------
/** Perform stream output.
Behaves as a formatted output function.
*/
BOOST_JSON_DECL
friend
std::ostream&
operator<<(std::ostream& os, string const& s);
private:
class undo;
@@ -2620,10 +2609,19 @@ private:
@par Preconditions
`&lhs != &rhs`
@par Complexity
@param lhs The string to swap.
Constant or linear in `lhs.size() + rhs.size()`.
@param rhs The string to swap.
@par Exception Safety
Strong guarantee.
Calls to @ref storage::allocate may throw.
@param lhs The string to exchange.
@param rhs The string to exchange.
*/
inline
void
@@ -2634,6 +2632,17 @@ swap(string& lhs, string& rhs)
//----------------------------------------------------------
/** Perform stream output.
Behaves as a formatted output function.
*/
inline
std::ostream&
operator<<(std::ostream& os, string const& s)
{
return os << static_cast<string_view>(s);
}
/** Return true if lhs equals rhs.
A lexicographical comparison is used.