How to return user name from vibed session?

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 10 05:46:19 PST 2015


On Thursday, 10 December 2015 at 13:43:58 UTC, Suliman wrote:
> On Thursday, 10 December 2015 at 13:34:02 UTC, Mike Parker 
> wrote:
>> On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote:
>>
>>>
>>> But question about why I need to get session info like:
>>>
>>> writeln("USER Session: ", req.session.get!string("username"));
>>>
>>> is still actual.
>>
>> When you have a template that looks like this:
>>
>> V get(V, K)(K key) {...}
>>
>> The compiler is able to deduce the type of K because of the 
>> argument 'key'. However, there's no way for it to know what V 
>> should be. You have to tell it explicitly when you instantiate 
>> it:
>>
>> auto str = get!string("key1");
>> auto i = get!int("key2");
>

because set return void, and get return T?


More information about the Digitalmars-d-learn mailing list