static_string<0> does not memcpy

fix #41
This commit is contained in:
alandefreitas
2023-01-11 23:14:58 -03:00
committed by Alan de Freitas
parent 9c3d5febe7
commit 82ff4e0679
2 changed files with 8 additions and 1 deletions

View File

@ -1319,7 +1319,7 @@ public:
basic_static_string&
assign(const basic_static_string& s) noexcept
{
if (this == &s)
if (data() == s.data())
return *this;
return assign_unchecked(s.data(), s.size());
}

View File

@ -674,6 +674,13 @@ testAssignment()
s_long.assign(s_long.data() + 2, 8);
BOOST_TEST(s_long == "rem ipsu");
// issue #41
{
boost::static_strings::static_string<0> a;
auto b = a;
BOOST_TEST(b == "");
}
}
// done