Skip to content

Commit

Permalink
Use initializer list instead of assigning in body
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXShady authored and ChrisThrasher committed Oct 5, 2024
1 parent 9af5d87 commit d4ee28c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/SFML/System/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,20 @@ U8StringCharTraits::int_type U8StringCharTraits::not_eof(int_type i) noexcept


////////////////////////////////////////////////////////////
String::String(char ansiChar, const std::locale& locale)
String::String(char ansiChar, const std::locale& locale) : m_string(1, Utf32::decodeAnsi(ansiChar, locale))
{
m_string += Utf32::decodeAnsi(ansiChar, locale);
}


////////////////////////////////////////////////////////////
String::String(wchar_t wideChar)
String::String(wchar_t wideChar) : m_string(1, Utf32::decodeWide(wideChar))
{
m_string += Utf32::decodeWide(wideChar);
}


////////////////////////////////////////////////////////////
String::String(char32_t utf32Char)
String::String(char32_t utf32Char) : m_string(1, utf32Char)
{
m_string += utf32Char;
}


Expand Down Expand Up @@ -207,10 +204,8 @@ String::String(const std::wstring& wideString)


////////////////////////////////////////////////////////////
String::String(const char32_t* utf32String)
String::String(const char32_t* utf32String) : m_string(utf32String ? utf32String : U"")
{
if (utf32String)
m_string = utf32String;
}


Expand Down

0 comments on commit d4ee28c

Please sign in to comment.