On Sunday, 12 January 2014 at 20:16:15 UTC, Nordlöw wrote:
Is there a trait to check whether a type has value or reference semantics?

I need this in a template struct that adaptively (using static if) represent histogram bins as either a dense static array or a sparse associative array.

No, afaik.

However, the question goes deeper than you might have though. You probably want to distuingish between structs+scalars vs classes. However, what about ref-arguments? Mutable arrays are struct values, but have reference semantics. Immutable-value arrays (e.g. string) have value semantics.

You could use one version as default and define special cases via some stuff you find in std.traits.

Reply via email to