Date: Fri, 16 May 2025 23:09:53 +0200
> On 16 May 2025, at 22:41, Jens Maurer <Jens.Maurer_at_[hidden]> wrote:
>
> On 16/05/2025 22.20, Hans Åberg wrote:
>>
>>> On 16 May 2025, at 21:15, Jens Maurer <Jens.Maurer_at_[hidden]> wrote:
>>>
>>>> Possibly, implicit conversions between char8_t and char32_t cause problems here.
>>>
>>> How so? Why would the presence or absence of a conversion between T and U
>>> affect the design space of supporting or not supporting a conversion between
>>> some_class<T> to some_class<U>?
>>
>> If one is using explicit char8_t which gets converted into std::u32string, but perhaps this is not a problem.
>
> Which example do you have in mind, specifically? I'm not finding a constructor
> that would enable such a conversion, at this moment.
An elaboration: The constructor is std::basic_string<CharT>(size_type, CharT), because std::basic_string<CharT>(CharT) might cause confusion with implicit conversions between size_type and CharT, I would gather. But if there are no such implicit conversions with the char8_t and char32_t types, one might have std::u32string(char32_t). It is primarily that there should be no implicit conversions to and from the char32_t type. —But I can't say if it is useful.
>
> On 16/05/2025 22.20, Hans Åberg wrote:
>>
>>> On 16 May 2025, at 21:15, Jens Maurer <Jens.Maurer_at_[hidden]> wrote:
>>>
>>>> Possibly, implicit conversions between char8_t and char32_t cause problems here.
>>>
>>> How so? Why would the presence or absence of a conversion between T and U
>>> affect the design space of supporting or not supporting a conversion between
>>> some_class<T> to some_class<U>?
>>
>> If one is using explicit char8_t which gets converted into std::u32string, but perhaps this is not a problem.
>
> Which example do you have in mind, specifically? I'm not finding a constructor
> that would enable such a conversion, at this moment.
An elaboration: The constructor is std::basic_string<CharT>(size_type, CharT), because std::basic_string<CharT>(CharT) might cause confusion with implicit conversions between size_type and CharT, I would gather. But if there are no such implicit conversions with the char8_t and char32_t types, one might have std::u32string(char32_t). It is primarily that there should be no implicit conversions to and from the char32_t type. —But I can't say if it is useful.
Received on 2025-05-16 21:10:12