gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Bug fix in maps.h.
0 1 0
default
1 file changed with 2 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 48 line context
... ...
@@ -1330,49 +1330,49 @@
1330 1330
  ///
1331 1331
  /// Writable bool map for logging each \c true assigned element by pushing
1332 1332
  /// them into a front insertable container.
1333 1333
  /// It can be used to retrieve the items into a standard
1334 1334
  /// container. For example see \ref BackInserterBoolMap.
1335 1335
  ///
1336 1336
  ///\sa BackInserterBoolMap
1337 1337
  ///\sa InserterBoolMap
1338 1338
  template <typename Container,
1339 1339
            typename Functor =
1340 1340
            _maps_bits::Identity<typename Container::value_type> >
1341 1341
  class FrontInserterBoolMap {
1342 1342
  public:
1343 1343
    typedef typename Container::value_type Key;
1344 1344
    typedef bool Value;
1345 1345

	
1346 1346
    /// Constructor
1347 1347
    FrontInserterBoolMap(Container& _container,
1348 1348
                         const Functor& _functor = Functor()) 
1349 1349
      : container(_container), functor(_functor) {}
1350 1350

	
1351 1351
    /// The \c set function of the map
1352 1352
    void set(const Key& key, Value value) {
1353 1353
      if (value) {
1354
	container.push_front(key);
1354
	container.push_front(functor(key));
1355 1355
      }
1356 1356
    }
1357 1357
    
1358 1358
  private:
1359 1359
    Container& container;    
1360 1360
    Functor functor;
1361 1361
  };
1362 1362

	
1363 1363
  /// \brief Writable bool map for storing each \c true assigned element in 
1364 1364
  /// an insertable container.
1365 1365
  ///
1366 1366
  /// Writable bool map for storing each \c true assigned element in an 
1367 1367
  /// insertable container. It will insert all the keys set to \c true into
1368 1368
  /// the container.
1369 1369
  ///
1370 1370
  /// For example, if you want to store the cut arcs of the strongly
1371 1371
  /// connected components in a set you can use the next code:
1372 1372
  ///
1373 1373
  ///\code
1374 1374
  /// set<Arc> cut_arcs;
1375 1375
  /// InserterBoolMap<set<Arc> > inserter_map(cut_arcs);
1376 1376
  /// stronglyConnectedCutArcs(digraph, cost, inserter_map);
1377 1377
  ///\endcode
1378 1378
  ///
... ...
@@ -1387,49 +1387,49 @@
1387 1387
    typedef bool Value;
1388 1388

	
1389 1389
    /// Constructor with specified iterator
1390 1390
    
1391 1391
    /// Constructor with specified iterator.
1392 1392
    /// \param _container The container for storing the elements.
1393 1393
    /// \param _it The elements will be inserted before this iterator.
1394 1394
    /// \param _functor The functor that is used when an element is stored.
1395 1395
    InserterBoolMap(Container& _container, typename Container::iterator _it,
1396 1396
                    const Functor& _functor = Functor()) 
1397 1397
      : container(_container), it(_it), functor(_functor) {}
1398 1398

	
1399 1399
    /// Constructor
1400 1400

	
1401 1401
    /// Constructor without specified iterator.
1402 1402
    /// The elements will be inserted before <tt>_container.end()</tt>.
1403 1403
    /// \param _container The container for storing the elements.
1404 1404
    /// \param _functor The functor that is used when an element is stored.
1405 1405
    InserterBoolMap(Container& _container, const Functor& _functor = Functor())
1406 1406
      : container(_container), it(_container.end()), functor(_functor) {}
1407 1407

	
1408 1408
    /// The \c set function of the map
1409 1409
    void set(const Key& key, Value value) {
1410 1410
      if (value) {
1411
	it = container.insert(it, key);
1411
	it = container.insert(it, functor(key));
1412 1412
        ++it;
1413 1413
      }
1414 1414
    }
1415 1415
    
1416 1416
  private:
1417 1417
    Container& container;
1418 1418
    typename Container::iterator it;
1419 1419
    Functor functor;
1420 1420
  };
1421 1421

	
1422 1422
  /// \brief Writable bool map for filling each \c true assigned element with a 
1423 1423
  /// given value.
1424 1424
  ///
1425 1425
  /// Writable bool map for filling each \c true assigned element with a 
1426 1426
  /// given value. The value can set the container.
1427 1427
  ///
1428 1428
  /// The following code finds the connected components of a graph
1429 1429
  /// and stores it in the \c comp map:
1430 1430
  ///\code
1431 1431
  /// typedef Graph::NodeMap<int> ComponentMap;
1432 1432
  /// ComponentMap comp(graph);
1433 1433
  /// typedef FillBoolMap<Graph::NodeMap<int> > ComponentFillerMap;
1434 1434
  /// ComponentFillerMap filler(comp, 0);
1435 1435
  ///
0 comments (0 inline)