summary refs log tree commit diff
path: root/src/test/run-pass/class-iface-bounded-param.rs
blob: b6dad43b5561348d6f1053e9a97a9935dea65294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// xfail-test

use std;
import std::map::{map, hashmap, int_hash};

class keys<K: copy, V: copy, M: copy map<K,V>>
    : iter::base_iter<K> {

    let map: M;

    new(map: M) {
        self.map = map;
    }

    fn each(blk: fn(K) -> bool) { self.map.each(|k, _v| blk(k) ) }
    fn size_hint() -> option<uint> { some(self.map.size()) }
    fn eachi(blk: fn(uint, K) -> bool) { iter::eachi(self, blk) }
}

fn main() {
    let m = int_hash();
    m.insert(1, 2);
    m.insert(3, 4);
    assert iter::to_vec(keys(m)) == ~[1, 3];
}