Skip to content

Linux/GCC 13 build fix for template specialization of pasteTextWithLinebreaks #2729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions indra/llui/lltexteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,9 +1594,7 @@ void LLTextEditor::cleanStringForPaste(LLWString & clean_string)
}
}


template <>
void LLTextEditor::pasteTextWithLinebreaks<LLWString>(const LLWString & clean_string)
void LLTextEditor::pasteTextWithLinebreaksImpl(const LLWString & clean_string)
{
std::basic_string<llwchar>::size_type start = 0;
std::basic_string<llwchar>::size_type pos = clean_string.find('\n',start);
Expand Down
5 changes: 2 additions & 3 deletions indra/llui/lltexteditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,9 @@ class LLTextEditor :
template <typename STRINGTYPE>
void pasteTextWithLinebreaks(const STRINGTYPE& clean_string)
{
pasteTextWithLinebreaks<LLWString>(ll_convert(clean_string));
pasteTextWithLinebreaksImpl(ll_convert(clean_string));
Copy link
Contributor

@Ansariel Ansariel Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

    void            pasteTextWithLinebreaks(const STRINGTYPE& clean_string)
    {
        if constexpr (std::is_same_v<LLWString, STRINGTYPE>)
            pasteTextWithLinebreaksImpl(clean_string);
        else
            pasteTextWithLinebreaksImpl(ll_convert(clean_string));
    }

to prevent an unnecessary ll_convert if not needed?

}
template <>
void pasteTextWithLinebreaks<LLWString>(const LLWString & clean_string);
void pasteTextWithLinebreaksImpl(const LLWString & clean_string);

private:
void onKeyStroke();
Expand Down
Loading