577 it = map.beginValue(); |
577 it = map.beginValue(); |
578 check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' && |
578 check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' && |
579 it == map.endValue(), "Wrong value iterator"); |
579 it == map.endValue(), "Wrong value iterator"); |
580 } |
580 } |
581 |
581 |
|
582 // CrossRefMap |
|
583 { |
|
584 typedef SmartDigraph Graph; |
|
585 DIGRAPH_TYPEDEFS(Graph); |
|
586 |
|
587 checkConcept<ReadWriteMap<Node, int>, |
|
588 CrossRefMap<Graph, Node, int> >(); |
|
589 |
|
590 Graph gr; |
|
591 typedef CrossRefMap<Graph, Node, char> CRMap; |
|
592 typedef CRMap::ValueIterator ValueIt; |
|
593 CRMap map(gr); |
|
594 |
|
595 Node n0 = gr.addNode(); |
|
596 Node n1 = gr.addNode(); |
|
597 Node n2 = gr.addNode(); |
|
598 |
|
599 map.set(n0, 'A'); |
|
600 map.set(n1, 'B'); |
|
601 map.set(n2, 'C'); |
|
602 map.set(n2, 'A'); |
|
603 map.set(n0, 'C'); |
|
604 |
|
605 check(map[n0] == 'C' && map[n1] == 'B' && map[n2] == 'A', |
|
606 "Wrong CrossRefMap"); |
|
607 check(map('A') == n2 && map.inverse()['A'] == n2, "Wrong CrossRefMap"); |
|
608 check(map('B') == n1 && map.inverse()['B'] == n1, "Wrong CrossRefMap"); |
|
609 check(map('C') == n0 && map.inverse()['C'] == n0, "Wrong CrossRefMap"); |
|
610 |
|
611 ValueIt it = map.beginValue(); |
|
612 check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' && |
|
613 it == map.endValue(), "Wrong value iterator"); |
|
614 } |
|
615 |
582 // Iterable bool map |
616 // Iterable bool map |
583 { |
617 { |
584 typedef SmartGraph Graph; |
618 typedef SmartGraph Graph; |
585 typedef SmartGraph::Node Item; |
619 typedef SmartGraph::Node Item; |
586 |
620 |