Hacker News new | ask | show | jobs
by gliop 2603 days ago
Is a value type different from a value class?

https://github.com/google/auto/blob/master/value/userguide/i...

1 comments

Yes, those value classes are still heap/GC allocated objects.

Value types are a generalisation of `int`, `long`, `float` (etc), where values are stored inline, not allocated on the heap. For instance, a `Pair<long, double>` that isn't a pointer, but is instead the exactly the size of a long plus a double, and is the same as writing `long first; double second;` inline.