数组的那点确实不对
搜了一下讨论,
数组的IntoIterator的一个方案是基于impl Trait的,一个是基于const generics的
不知道最后选的哪个
https://github.com/rust-lang/rust/pull/32871
https://github.com/rust-lang/rust/issues/25725
https://github.com/rust-lang/rust/pull/65819
【 在 ilovecpp 的大作中提到: 】
: 这个理解不对。Vec的into_iter不是通过“丢弃它的元素(缩小)”实现的。IntoIter拿走了原Vec的整个buffer,原Vec在into_iter之后直接消失。
: 数组没有into_iter只是rust编译器的技术限制,没有什么原理上的困难。相关代码上个月刚刚加入,rust下个版本里数组应该可以直接for in了。
--
FROM 123.115.133.*