[Lemon-commits] Peter Kovacs: Simplify hello_lemon.cc with 'usin...

Lemon HG hg at lemon.cs.elte.hu
Mon Feb 22 19:46:51 CET 2010


details:   http://lemon.cs.elte.hu/hg/lemon-tutorial/rev/199a65b64d90
changeset: 36:199a65b64d90
user:      Peter Kovacs <kpeter [at] inf.elte.hu>
date:      Sat Feb 20 19:02:04 2010 +0100
description:
	Simplify hello_lemon.cc with 'using namespace' commands

diffstat:

 demo/hello_lemon.cc |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (42 lines):

diff --git a/demo/hello_lemon.cc b/demo/hello_lemon.cc
--- a/demo/hello_lemon.cc
+++ b/demo/hello_lemon.cc
@@ -2,7 +2,7 @@
  *
  * This file is a part of LEMON, a generic C++ optimization library.
  *
- * Copyright (C) 2003-2009
+ * Copyright (C) 2003-2010
  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
  * (Egervary Research Group on Combinatorial Optimization, EGRES).
  *
@@ -25,19 +25,20 @@
 #include <iostream>
 #include <lemon/list_graph.h>
 
+using namespace lemon;
+using namespace std;
+
 int main()
 {
-  typedef lemon::ListDigraph Graph;
-  Graph g;
+  ListDigraph g;
 
-  Graph::Node u = g.addNode();
-  Graph::Node v = g.addNode();
-  Graph::Arc  e = g.addArc(u, v);
+  ListDigraph::Node u = g.addNode();
+  ListDigraph::Node v = g.addNode();
+  ListDigraph::Arc  a = g.addArc(u, v);
 
-  std::cout << "Hello World! This is LEMON library here." << std::endl;
-  std::cout << "We have a directed graph with "
-            << countNodes(g) << " nodes and "
-            << countArcs(g) << " arc." << std::endl;
+  cout << "Hello World! This is LEMON library here." << endl;
+  cout << "We have a directed graph with " << countNodes(g) << " nodes "
+       << "and " << countArcs(g) << " arc." << endl;
 
   return 0;
 }



More information about the Lemon-commits mailing list