Good examples of value types
Justin Whear via Digitalmars-d
digitalmars-d at puremagic.com
Tue May 5 14:04:22 PDT 2015
On Tue, 05 May 2015 20:40:58 +0000, Luís Marques wrote:
> could you come up with some type that would really benefit from being a
> value type but that isn't numeric (or otherwise similar)?
Dates, times, durations, regular expressions, tokens, lazy generators,
digests, vectors, really any type that provides a interpretation/behavior
wrapper around one or more trivially copyable types.
Frankly, the real divide in my mind is polymorphic/non-polymorphic, not
by-reference vs by-value, though I will occasionally use `final class` if
I want a convenience reference type around a resource.
More information about the Digitalmars-d
mailing list