On Fri, Dec 9, 2011 at 4:39 AM, Marijn Haverbeke <[email protected]> wrote:
> Ah, I should have clarified. 'none' refers to the std::option type,
> which is defined as `tag option<T> { none; some(T); }`.
>
>> let x = MyContainer<MysteryT>();
>> x.insert(3); // now infer that x is really a MyContainer<int>
>>
>> How would the compiler infer that?
>
> Well, you can't write <MysteryT> there, but you can leave off the <>
> part, and the type parameter will be unified with the type of the 3,
> and things will Just Work.

Oh, nifty :)
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to