Changes in / [989:38e1d4383262:991:a10624ed1997] in lemon-main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/path.h
r920 r991 65 65 Path() {} 66 66 67 /// \brief Copy constructor 68 /// 69 Path(const Path& cpath) { 70 pathCopy(cpath, *this); 71 } 72 67 73 /// \brief Template copy constructor 68 74 /// … … 72 78 Path(const CPath& cpath) { 73 79 pathCopy(cpath, *this); 80 } 81 82 /// \brief Copy assignment 83 /// 84 Path& operator=(const Path& cpath) { 85 pathCopy(cpath, *this); 86 return *this; 74 87 } 75 88 … … 253 266 SimplePath() {} 254 267 268 /// \brief Copy constructor 269 /// 270 SimplePath(const SimplePath& cpath) { 271 pathCopy(cpath, *this); 272 } 273 255 274 /// \brief Template copy constructor 256 275 /// … … 260 279 SimplePath(const CPath& cpath) { 261 280 pathCopy(cpath, *this); 281 } 282 283 /// \brief Copy assignment 284 /// 285 SimplePath& operator=(const SimplePath& cpath) { 286 pathCopy(cpath, *this); 287 return *this; 262 288 } 263 289 … … 432 458 ListPath() : first(0), last(0) {} 433 459 460 /// \brief Copy constructor 461 /// 462 ListPath(const ListPath& cpath) : first(0), last(0) { 463 pathCopy(cpath, *this); 464 } 465 434 466 /// \brief Template copy constructor 435 467 /// … … 446 478 ~ListPath() { 447 479 clear(); 480 } 481 482 /// \brief Copy assignment 483 /// 484 ListPath& operator=(const ListPath& cpath) { 485 pathCopy(cpath, *this); 486 return *this; 448 487 } 449 488 … … 759 798 StaticPath() : len(0), arcs(0) {} 760 799 800 /// \brief Copy constructor 801 /// 802 StaticPath(const StaticPath& cpath) : arcs(0) { 803 pathCopy(cpath, *this); 804 } 805 761 806 /// \brief Template copy constructor 762 807 /// … … 772 817 ~StaticPath() { 773 818 if (arcs) delete[] arcs; 819 } 820 821 /// \brief Copy assignment 822 /// 823 StaticPath& operator=(const StaticPath& cpath) { 824 pathCopy(cpath, *this); 825 return *this; 774 826 } 775 827 -
test/path_test.cc
r440 r990 39 39 } 40 40 41 // Check if proper copy consructor is called (use valgrind for testing) 42 template<class _Path> 43 void checkCopy() 44 { 45 ListDigraph g; 46 ListDigraph::Arc a = g.addArc(g.addNode(), g.addNode()); 47 48 _Path p,q; 49 p.addBack(a); 50 q=p; 51 _Path r(p); 52 StaticPath<ListDigraph> s(r); 53 } 54 41 55 int main() { 42 56 check_concepts(); 57 58 checkCopy<Path<ListDigraph> >(); 59 checkCopy<SimplePath<ListDigraph> >(); 60 checkCopy<ListPath<ListDigraph> >(); 61 62 ListDigraph g; 63 ListDigraph::Arc a = g.addArc(g.addNode(), g.addNode()); 64 65 Path<ListDigraph> p; 66 StaticPath<ListDigraph> q,r; 67 p.addBack(a); 68 q=p; 69 r=q; 70 StaticPath<ListDigraph> s(q); 71 43 72 return 0; 44 73 }
Note: See TracChangeset
for help on using the changeset viewer.