If a struct in #cplusplus is trivally copyable, should the copy guarantee that it is also trivially comparable (ie, memcmp())?
Turns out it's not. There isn't really a concept of "trivially comparable" as far as I can tell.
I haven't tested enough, but it seems that for other cases (ie, non-empty structs) it works out okay.
-
-
Perhaps the giveaway to the lack of guarantee is that the compiler will automatically generate operator=(), but not operator==().
Näytä tämä ketjuKiitos. Käytämme tätä aikajanasi parantamiseen. KumoaKumoa
-
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.