Skip to content

Conversation

@pps83
Copy link
Contributor

@pps83 pps83 commented Jan 23, 2026

Keep address-of first char for c++11 compatibility

Note, original pr was done against abseil, which is c++17 now. This lib seem to still reference older versions.

// TODO: Switch to std::string::data() when we require C++17 or higher.
len = static_cast<std::size_t>(::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, ptr, chars_len, &result[0],
CP_UTF8, WC_ERR_INVALID_CHARS, ptr, chars_len, result.data(),
Copy link
Contributor

Choose a reason for hiding this comment

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

This lib seem to still reference older versions.

Yes, CCTZ version 2.X only requires C++11, so this has to stay as-is for now.

Copy link
Contributor Author

@pps83 pps83 Jan 23, 2026

Choose a reason for hiding this comment

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

perhaps, TODO should then be removed? Code ensures it's non empty, no need to switch to .data() imo

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct ... there is no need to switch to .data(). The contributor of this code just thought it would be nice when C++17 is required. Presumably you thought the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should I remove this TODO, or simply close the PR? let me know

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy either way, so your choice.

@pps83 pps83 changed the title Switch to std::string::data() in Utf16ToUtf8 (C++17) Remove unnecessary TODO Jan 23, 2026
Copy link
Contributor

@devbww devbww left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks.

We'll have to wait for owners @derekmauro or @dinord though.

@derekmauro
Copy link
Member

It looks like our CI needs some maintenance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants