Add an undirected() function (#364)
authorPeter Kovacs <kpeter@inf.elte.hu>
Mon, 05 Apr 2010 23:41:05 +0200
changeset 883dc376822c17d
parent 881 87569cb5734d
child 884 6dd226d3dcba
Add an undirected() function (#364)
lemon/core.h
     1.1 --- a/lemon/core.h	Wed Mar 17 14:05:23 2010 +0100
     1.2 +++ b/lemon/core.h	Mon Apr 05 23:41:05 2010 +0200
     1.3 @@ -445,6 +445,25 @@
     1.4  
     1.5    }
     1.6  
     1.7 +  /// Check whether a graph is undirected.
     1.8 +  ///
     1.9 +  /// This function returns \c true if the given graph is undirected.
    1.10 +#ifdef DOXYGEN
    1.11 +  template <typename GR>
    1.12 +  bool undirected(const GR& g) { return false; }
    1.13 +#else
    1.14 +  template <typename GR>
    1.15 +  typename enable_if<UndirectedTagIndicator<GR>, bool>::type
    1.16 +  undirected(const GR&) {
    1.17 +    return true;
    1.18 +  }
    1.19 +  template <typename GR>
    1.20 +  typename disable_if<UndirectedTagIndicator<GR>, bool>::type
    1.21 +  undirected(const GR&) {
    1.22 +    return false;
    1.23 +  }
    1.24 +#endif
    1.25 +
    1.26    /// \brief Class to copy a digraph.
    1.27    ///
    1.28    /// Class to copy a digraph to another digraph (duplicate a digraph). The