G4GenericMessenger and std::optional

I couldn’t really find an appropriate category in which to post this question. This seemed like the least inappropriate one.

I would like to use G4GenericMessenger to set fields of type std::optional<whatever> where, in the first instance, whatever = G4String. This appears not to work. It appears to be because G4AnyType (on which the former depends) does not understand std::optional.

Is it possible to set std::optionals with G4GenericMessenger?