What does std.traits.hasAliasing do

Venkat venkatram.akkineni at gmail.com
Sun Jul 29 01:05:19 UTC 2018


struct SomeStruct {
	string p;
	string q;
	string[] pq;
}

ErrorMessage[] pq;
session.set("registerBody", pq);

/home/venkat/.dub/packages/vibe-d-0.8.4/vibe-d/http/vibe/http/session.d(83,3): Error: static assert:  "Type SomeStruct contains references, which is not supported for session storage."


vibe.d session won't let me put in a simple struct with an array 
or an associative array. session.put calls std.traits.hasAliasing 
which is returning true when I have either an array or an 
associative array. I looked through the std.traits.hasAliasing 
code. I can't make a whole lot of sense there.

The hasAliasing function documentation says as long as the array 
or associative array are not immutable it should return true. 
Since session.put does !hasAliasing I changed string[] to 
immutable, that throws a whole lot of other compilation error 
messages.

What is hasAliasing doing ?


More information about the Digitalmars-d-learn mailing list