lemon/path.h
changeset 145 95d905b6e33d
parent 100 4f754b4cf82b
child 157 2ccc1afc2c52
     1.1 --- a/lemon/path.h	Tue Apr 22 15:07:04 2008 +0200
     1.2 +++ b/lemon/path.h	Tue Apr 22 17:52:01 2008 +0100
     1.3 @@ -903,20 +903,34 @@
     1.4    namespace _path_bits {
     1.5  
     1.6      template <typename Path, typename Enable = void>
     1.7 -    struct RevTagIndicator {
     1.8 +    struct RevPathTagIndicator {
     1.9        static const bool value = false;
    1.10      };
    1.11  
    1.12 -    template <typename Digraph>
    1.13 -    struct RevTagIndicator<
    1.14 -      Digraph, 
    1.15 -      typename enable_if<typename Digraph::RevTag, void>::type
    1.16 +    template <typename Path>
    1.17 +    struct RevPathTagIndicator<
    1.18 +      Path, 
    1.19 +      typename enable_if<typename Path::RevPathTag, void>::type
    1.20 +      > {
    1.21 +      static const bool value = true;
    1.22 +    };
    1.23 +
    1.24 +    template <typename Path, typename Enable = void>
    1.25 +    struct BuildTagIndicator {
    1.26 +      static const bool value = false;
    1.27 +    };
    1.28 +
    1.29 +    template <typename Path>
    1.30 +    struct BuildTagIndicator<
    1.31 +      Path, 
    1.32 +      typename enable_if<typename Path::BuildTag, void>::type
    1.33      > {
    1.34        static const bool value = true;
    1.35      };
    1.36  
    1.37      template <typename Target, typename Source,
    1.38 -              typename BuildEnable = void, typename RevEnable = void>
    1.39 +	      bool buildEnable = BuildTagIndicator<Target>::value, 
    1.40 +	      bool revEnable = RevPathTagIndicator<Source>::value>
    1.41      struct PathCopySelector {
    1.42        static void copy(Target& target, const Source& source) {
    1.43          target.clear();
    1.44 @@ -926,10 +940,8 @@
    1.45        }
    1.46      };
    1.47  
    1.48 -    template <typename Target, typename Source, typename BuildEnable>
    1.49 -    struct PathCopySelector<
    1.50 -      Target, Source, BuildEnable, 
    1.51 -      typename enable_if<typename Source::RevPathTag, void>::type> {
    1.52 +    template <typename Target, typename Source>
    1.53 +    struct PathCopySelector<Target, Source, false, true> {
    1.54        static void copy(Target& target, const Source& source) {
    1.55          target.clear();
    1.56          for (typename Source::RevArcIt it(source); it != INVALID; ++it) {
    1.57 @@ -938,10 +950,8 @@
    1.58        }
    1.59      };
    1.60  
    1.61 -    template <typename Target, typename Source, typename RevEnable>
    1.62 -    struct PathCopySelector<
    1.63 -      Target, Source, 
    1.64 -      typename enable_if<typename Target::BuildTag, void>::type, RevEnable> {
    1.65 +    template <typename Target, typename Source>
    1.66 +    struct PathCopySelector<Target, Source, true, false> {
    1.67        static void copy(Target& target, const Source& source) {
    1.68          target.clear();
    1.69          target.build(source);
    1.70 @@ -949,10 +959,7 @@
    1.71      };
    1.72  
    1.73      template <typename Target, typename Source>
    1.74 -    struct PathCopySelector<
    1.75 -      Target, Source, 
    1.76 -      typename enable_if<typename Target::BuildTag, void>::type,
    1.77 -      typename enable_if<typename Source::RevPathTag, void>::type> {
    1.78 +    struct PathCopySelector<Target, Source, true, true> {
    1.79        static void copy(Target& target, const Source& source) {
    1.80          target.clear();
    1.81          target.buildRev(source);