[Lemon-commits] Peter Kovacs: Add an undirected() function (#364)

Lemon HG hg at lemon.cs.elte.hu
Tue Apr 6 07:10:09 CEST 2010


details:   http://lemon.cs.elte.hu/hg/lemon/rev/dc376822c17d
changeset: 966:dc376822c17d
user:      Peter Kovacs <kpeter [at] inf.elte.hu>
date:      Mon Apr 05 23:41:05 2010 +0200
description:
	Add an undirected() function (#364)

diffstat:

 lemon/core.h |  19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diffs (29 lines):

diff --git a/lemon/core.h b/lemon/core.h
--- a/lemon/core.h
+++ b/lemon/core.h
@@ -445,6 +445,25 @@
 
   }
 
+  /// Check whether a graph is undirected.
+  ///
+  /// This function returns \c true if the given graph is undirected.
+#ifdef DOXYGEN
+  template <typename GR>
+  bool undirected(const GR& g) { return false; }
+#else
+  template <typename GR>
+  typename enable_if<UndirectedTagIndicator<GR>, bool>::type
+  undirected(const GR&) {
+    return true;
+  }
+  template <typename GR>
+  typename disable_if<UndirectedTagIndicator<GR>, bool>::type
+  undirected(const GR&) {
+    return false;
+  }
+#endif
+
   /// \brief Class to copy a digraph.
   ///
   /// Class to copy a digraph to another digraph (duplicate a digraph). The



More information about the Lemon-commits mailing list