... | ... |
@@ -207,24 +207,34 @@ |
207 | 207 |
} |
208 | 208 |
|
209 | 209 |
std::sort(seq.begin(), seq.end(), PairComp<Sequence>()); |
210 | 210 |
return KruskalOutputSelector<Graph, Sequence, Out>:: |
211 | 211 |
kruskal(graph, seq, out); |
212 | 212 |
} |
213 | 213 |
}; |
214 | 214 |
|
215 |
template <typename T> |
|
216 |
struct RemoveConst { |
|
217 |
typedef T type; |
|
218 |
}; |
|
219 |
|
|
220 |
template <typename T> |
|
221 |
struct RemoveConst<const T> { |
|
222 |
typedef T type; |
|
223 |
}; |
|
224 |
|
|
215 | 225 |
template <typename Graph, typename In, typename Out> |
216 | 226 |
struct KruskalOutputSelector<Graph, In, Out, |
217 | 227 |
typename enable_if<SequenceOutputIndicator<Out>, void>::type > |
218 | 228 |
{ |
219 | 229 |
typedef typename In::value_type::second_type Value; |
220 | 230 |
|
221 | 231 |
static Value kruskal(const Graph& graph, const In& in, Out& out) { |
222 |
typedef StoreBoolMap<Out> Map; |
|
232 |
typedef StoreBoolMap<typename RemoveConst<Out>::type> Map; |
|
223 | 233 |
Map map(out); |
224 | 234 |
return _kruskal_bits::kruskal(graph, in, map); |
225 | 235 |
} |
226 | 236 |
|
227 | 237 |
}; |
228 | 238 |
|
229 | 239 |
template <typename Graph, typename In, typename Out> |
230 | 240 |
struct KruskalOutputSelector<Graph, In, Out, |
... | ... |
@@ -80,17 +80,17 @@ |
80 | 80 |
map1 = nullMap<A,B>(); |
81 | 81 |
} |
82 | 82 |
|
83 | 83 |
// ConstMap |
84 | 84 |
{ |
85 | 85 |
checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >(); |
86 | 86 |
checkConcept<ReadWriteMap<A,C>, ConstMap<A,C> >(); |
87 | 87 |
ConstMap<A,B> map1; |
88 |
ConstMap<A,B> map2 |
|
88 |
ConstMap<A,B> map2 = B(); |
|
89 | 89 |
ConstMap<A,B> map3 = map1; |
90 | 90 |
map1 = constMap<A>(B()); |
91 | 91 |
map1 = constMap<A,B>(); |
92 | 92 |
map1.setAll(B()); |
93 | 93 |
ConstMap<A,C> map4(C(1)); |
94 | 94 |
ConstMap<A,C> map5 = map4; |
95 | 95 |
map4 = constMap<A>(C(2)); |
96 | 96 |
map4.setAll(C(3)); |
... | ... |
@@ -138,17 +138,17 @@ |
138 | 138 |
check(map9.size() == 10 && map9[2] == 0 && map9[5] == 100, |
139 | 139 |
"Something is wrong with RangeMap"); |
140 | 140 |
} |
141 | 141 |
|
142 | 142 |
// SparseMap |
143 | 143 |
{ |
144 | 144 |
checkConcept<ReferenceMap<A,B,B&,const B&>, SparseMap<A,B> >(); |
145 | 145 |
SparseMap<A,B> map1; |
146 |
SparseMap<A,B> map2 |
|
146 |
SparseMap<A,B> map2 = B(); |
|
147 | 147 |
SparseMap<A,B> map3 = sparseMap<A,B>(); |
148 | 148 |
SparseMap<A,B> map4 = sparseMap<A>(B()); |
149 | 149 |
|
150 | 150 |
checkConcept< ReferenceMap<double, int, int&, const int&>, |
151 | 151 |
SparseMap<double, int> >(); |
152 | 152 |
std::map<double, int> m; |
153 | 153 |
SparseMap<double, int> map5(m); |
154 | 154 |
SparseMap<double, int> map6(m,10); |
0 comments (0 inline)