diff --git a/include/boost/interprocess/detail/char_wchar_holder.hpp b/include/boost/interprocess/detail/char_wchar_holder.hpp index 8831aa20..0c078715 100644 --- a/include/boost/interprocess/detail/char_wchar_holder.hpp +++ b/include/boost/interprocess/detail/char_wchar_holder.hpp @@ -57,6 +57,7 @@ class char_wchar_holder this->delete_mem(); m_str.n = tmp; std::strcpy(m_str.n, nstr); + m_is_wide = false; return *this; } @@ -66,15 +67,16 @@ class char_wchar_holder this->delete_mem(); m_str.w = tmp; std::wcscpy(m_str.w, wstr); + m_is_wide = true; return *this; } char_wchar_holder& operator=(const char_wchar_holder &other) { if (other.m_is_wide) - *this = other.getn(); - else *this = other.getw(); + else + *this = other.getn(); return *this; }