sheredom / utf8.h

📚 single header utf8 string functions for C and C++
The Unlicense
1.69k stars 123 forks source link

Add constexpr to most functions (use char8_t for C++20) #92

Closed Guekka closed 2 years ago

Guekka commented 2 years ago

This feature required more changes than expected. I will understand if you prefer not to merge it

See the commit history for details, and please ask me anything if you need to

sheredom commented 2 years ago

Oh to be clear, I love this PR! 😄

Guekka commented 2 years ago

Oh to be clear, I love this PR! 😄 Thanks! 😃

Guekka commented 2 years ago

I think we're good

Guekka commented 2 years ago

It looks like GCC does not like the const_cast in some functions. But I'm not sure how to fix this

We can remove the const_cast, but it would change the API. And C has no overloading, so we cannot create const and non const overloads

Personally, I'd remove the const cast and let the caller handle it. But this differs from string.h API

Guekka commented 2 years ago

Looks like everything compiles. At last. It's a pain working with compilers that I don't have locally

I think this PR is complete

sheredom commented 2 years ago

Thanks for all the work! Great job fighting through CI fun.