I'm using Wt::WFormModel, the examples for which represent field names as static const char*
's. I made a bunch of changes to my project at one time, one of which was changing the field representation to be constexpr
. After much troubleshooting, I found this statement in the WFormModel documentation:
The Field type is
const char *
, and instead of string comparisons to identify fields, pointer comparisons are used. Thus you really should use the same field constant throughout your code to refer to a given field, and you cannot use C++11constexpr
for the field constant since that does not have a unique value (since it has no storage).
How does the representation of a constexpr char*
compare to the representation of a const char*
?
Aucun commentaire:
Enregistrer un commentaire