wutil.h: enable implicit conversion from wcharz_t to wcstring

This allows to write

    wcstring result = some_rust_function_that_returns_wcharz_t();
This commit is contained in:
Johannes Altmanninger 2023-02-05 11:14:08 +01:00
parent bfa94bfa7a
commit 47cc98fd57

View file

@ -31,6 +31,7 @@ struct wcharz_t {
/* implicit */ wcharz_t(const wchar_t *s) : str(s) {}
operator const wchar_t *() const { return str; }
operator wcstring() const { return str; }
inline size_t size() const { return wcslen(str); }
inline size_t length() const { return size(); }