What does std.traits.hasAliasing do
Venkat
venkatram.akkineni at gmail.com
Sun Jul 29 01:21:00 UTC 2018
On Sunday, 29 July 2018 at 01:05:19 UTC, Venkat wrote:
> struct SomeStruct {
> string p;
> string q;
> string[] pq;
> }
>
Session session = req.session;
session.get!SomeStruct("registerBody");
>
> /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 ?
Posted the wrong code. Fixed it above. Reposting below for
clarity. For the record both session.get and session.put call
hasAliasing.
struct SomeStruct {
string p;
string q;
string[] pq;
}
Session session = req.session;
session.get!SomeStruct("registerBody");
More information about the Digitalmars-d-learn
mailing list