gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Change Graph::Edge -> Graph::Arc inheritance to conversion (#283)
0 1 0
default
1 file changed with 5 insertions and 3 deletions:
↑ Collapse diff ↑
Ignore white space 32 line context
... ...
@@ -297,71 +297,73 @@
297 297

	
298 298
        /// Sets the iterator to the value of the trivial iterator \c e.
299 299
        /// This feature necessitates that each time we
300 300
        /// iterate the arc-set, the iteration order is the same.
301 301
        IncEdgeIt(const Graph&, const Edge&) { }
302 302
        /// Next incident arc
303 303

	
304 304
        /// Assign the iterator to the next incident arc
305 305
        /// of the corresponding node.
306 306
        IncEdgeIt& operator++() { return *this; }
307 307
      };
308 308

	
309 309
      /// The directed arc type.
310 310

	
311 311
      /// The directed arc type. It can be converted to the
312 312
      /// edge or it should be inherited from the undirected
313
      /// arc.
314
      class Arc : public Edge {
313
      /// edge.
314
      class Arc {
315 315
      public:
316 316
        /// Default constructor
317 317

	
318 318
        /// @warning The default constructor sets the iterator
319 319
        /// to an undefined value.
320 320
        Arc() { }
321 321
        /// Copy constructor.
322 322

	
323 323
        /// Copy constructor.
324 324
        ///
325
        Arc(const Arc& e) : Edge(e) { }
325
        Arc(const Arc&) { }
326 326
        /// Initialize the iterator to be invalid.
327 327

	
328 328
        /// Initialize the iterator to be invalid.
329 329
        ///
330 330
        Arc(Invalid) { }
331 331
        /// Equality operator
332 332

	
333 333
        /// Two iterators are equal if and only if they point to the
334 334
        /// same object or both are invalid.
335 335
        bool operator==(Arc) const { return true; }
336 336
        /// Inequality operator
337 337

	
338 338
        /// \sa operator==(Arc n)
339 339
        ///
340 340
        bool operator!=(Arc) const { return true; }
341 341

	
342 342
        /// Artificial ordering operator.
343 343

	
344 344
        /// To allow the use of graph descriptors as key type in std::map or
345 345
        /// similar associative container we require this.
346 346
        ///
347 347
        /// \note This operator only have to define some strict ordering of
348 348
        /// the items; this order has nothing to do with the iteration
349 349
        /// ordering of the items.
350 350
        bool operator<(Arc) const { return false; }
351 351

	
352
        /// Converison to Edge
353
        operator Edge() const { return Edge(); }
352 354
      };
353 355
      /// This iterator goes through each directed arc.
354 356

	
355 357
      /// This iterator goes through each arc of a graph.
356 358
      /// Its usage is quite simple, for example you can count the number
357 359
      /// of arcs in a graph \c g of type \c Graph as follows:
358 360
      ///\code
359 361
      /// int count=0;
360 362
      /// for(Graph::ArcIt e(g); e!=INVALID; ++e) ++count;
361 363
      ///\endcode
362 364
      class ArcIt : public Arc {
363 365
      public:
364 366
        /// Default constructor
365 367

	
366 368
        /// @warning The default constructor sets the iterator
367 369
        /// to an undefined value.
0 comments (0 inline)