Constructors. Yes. All of them.
Right, but that puts the owness on the user to know he has to make this copy() call. When writing a generic array class, you're likely going to memcpy. Or you'll provide a copy function to the array class. Or have an overloaded copy() function all classes must do.
-
-
At what point are you asking just a language-supported copy operator? (thought I guess copy assignments still exist, it's mostly a matter of whether the destination has valid initial values)
-
Rust has a Copy trait that you can opt into. That seems fine and could be the type of things you'd add as a consequence after you've removed the constructors. But if not.. eh, no big deal. Just write C like code. Can't copy if you only have a Foo* and don't know the size!
- Näytä vastaukset
Uusi keskustelu -
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.