... | ... |
@@ -1287,84 +1287,84 @@ |
1287 | 1287 |
|
1288 | 1288 |
/// \brief Writable bool map for logging each \c true assigned element in |
1289 | 1289 |
/// a back insertable container. |
1290 | 1290 |
/// |
1291 | 1291 |
/// Writable bool map for logging each \c true assigned element by pushing |
1292 | 1292 |
/// them into a back insertable container. |
1293 | 1293 |
/// It can be used to retrieve the items into a standard |
1294 | 1294 |
/// container. The next example shows how you can store the |
1295 | 1295 |
/// edges found by the Prim algorithm in a vector. |
1296 | 1296 |
/// |
1297 | 1297 |
///\code |
1298 | 1298 |
/// vector<Edge> span_tree_edges; |
1299 | 1299 |
/// BackInserterBoolMap<vector<Edge> > inserter_map(span_tree_edges); |
1300 | 1300 |
/// prim(graph, cost, inserter_map); |
1301 | 1301 |
///\endcode |
1302 | 1302 |
/// |
1303 | 1303 |
///\sa StoreBoolMap |
1304 | 1304 |
///\sa FrontInserterBoolMap |
1305 | 1305 |
///\sa InserterBoolMap |
1306 | 1306 |
template <typename Container, |
1307 | 1307 |
typename Functor = |
1308 | 1308 |
_maps_bits::Identity<typename Container::value_type> > |
1309 | 1309 |
class BackInserterBoolMap { |
1310 | 1310 |
public: |
1311 |
typedef typename |
|
1311 |
typedef typename Functor::argument_type Key; |
|
1312 | 1312 |
typedef bool Value; |
1313 | 1313 |
|
1314 | 1314 |
/// Constructor |
1315 | 1315 |
BackInserterBoolMap(Container& _container, |
1316 | 1316 |
const Functor& _functor = Functor()) |
1317 | 1317 |
: container(_container), functor(_functor) {} |
1318 | 1318 |
|
1319 | 1319 |
/// The \c set function of the map |
1320 | 1320 |
void set(const Key& key, Value value) { |
1321 | 1321 |
if (value) { |
1322 | 1322 |
container.push_back(functor(key)); |
1323 | 1323 |
} |
1324 | 1324 |
} |
1325 | 1325 |
|
1326 | 1326 |
private: |
1327 | 1327 |
Container& container; |
1328 | 1328 |
Functor functor; |
1329 | 1329 |
}; |
1330 | 1330 |
|
1331 | 1331 |
/// \brief Writable bool map for logging each \c true assigned element in |
1332 | 1332 |
/// a front insertable container. |
1333 | 1333 |
/// |
1334 | 1334 |
/// Writable bool map for logging each \c true assigned element by pushing |
1335 | 1335 |
/// them into a front insertable container. |
1336 | 1336 |
/// It can be used to retrieve the items into a standard |
1337 | 1337 |
/// container. For example see \ref BackInserterBoolMap. |
1338 | 1338 |
/// |
1339 | 1339 |
///\sa BackInserterBoolMap |
1340 | 1340 |
///\sa InserterBoolMap |
1341 | 1341 |
template <typename Container, |
1342 | 1342 |
typename Functor = |
1343 | 1343 |
_maps_bits::Identity<typename Container::value_type> > |
1344 | 1344 |
class FrontInserterBoolMap { |
1345 | 1345 |
public: |
1346 |
typedef typename |
|
1346 |
typedef typename Functor::argument_type Key; |
|
1347 | 1347 |
typedef bool Value; |
1348 | 1348 |
|
1349 | 1349 |
/// Constructor |
1350 | 1350 |
FrontInserterBoolMap(Container& _container, |
1351 | 1351 |
const Functor& _functor = Functor()) |
1352 | 1352 |
: container(_container), functor(_functor) {} |
1353 | 1353 |
|
1354 | 1354 |
/// The \c set function of the map |
1355 | 1355 |
void set(const Key& key, Value value) { |
1356 | 1356 |
if (value) { |
1357 | 1357 |
container.push_front(functor(key)); |
1358 | 1358 |
} |
1359 | 1359 |
} |
1360 | 1360 |
|
1361 | 1361 |
private: |
1362 | 1362 |
Container& container; |
1363 | 1363 |
Functor functor; |
1364 | 1364 |
}; |
1365 | 1365 |
|
1366 | 1366 |
/// \brief Writable bool map for storing each \c true assigned element in |
1367 | 1367 |
/// an insertable container. |
1368 | 1368 |
/// |
1369 | 1369 |
/// Writable bool map for storing each \c true assigned element in an |
1370 | 1370 |
/// insertable container. It will insert all the keys set to \c true into |
0 comments (0 inline)