lemon/path.h
changeset 517 2b6d5d22bb23
parent 440 88ed40ad0d4f
parent 487 afd134142111
child 559 c5fd2d996909
     1.1 --- a/lemon/path.h	Fri Feb 20 18:43:34 2009 +0100
     1.2 +++ b/lemon/path.h	Fri Feb 20 21:37:19 2009 +0000
     1.3 @@ -929,9 +929,8 @@
     1.4      };
     1.5  
     1.6      template <typename Target, typename Source,
     1.7 -              bool buildEnable = BuildTagIndicator<Target>::value,
     1.8 -              bool revEnable = RevPathTagIndicator<Source>::value>
     1.9 -    struct PathCopySelector {
    1.10 +              bool buildEnable = BuildTagIndicator<Target>::value>
    1.11 +    struct PathCopySelectorForward {
    1.12        static void copy(Target& target, const Source& source) {
    1.13          target.clear();
    1.14          for (typename Source::ArcIt it(source); it != INVALID; ++it) {
    1.15 @@ -941,7 +940,16 @@
    1.16      };
    1.17  
    1.18      template <typename Target, typename Source>
    1.19 -    struct PathCopySelector<Target, Source, false, true> {
    1.20 +    struct PathCopySelectorForward<Target, Source, true> {
    1.21 +      static void copy(Target& target, const Source& source) {
    1.22 +        target.clear();
    1.23 +        target.build(source);
    1.24 +      }
    1.25 +    };
    1.26 +
    1.27 +    template <typename Target, typename Source,
    1.28 +              bool buildEnable = BuildTagIndicator<Target>::value>
    1.29 +    struct PathCopySelectorBackward {
    1.30        static void copy(Target& target, const Source& source) {
    1.31          target.clear();
    1.32          for (typename Source::RevArcIt it(source); it != INVALID; ++it) {
    1.33 @@ -951,21 +959,29 @@
    1.34      };
    1.35  
    1.36      template <typename Target, typename Source>
    1.37 -    struct PathCopySelector<Target, Source, true, false> {
    1.38 -      static void copy(Target& target, const Source& source) {
    1.39 -        target.clear();
    1.40 -        target.build(source);
    1.41 -      }
    1.42 -    };
    1.43 -
    1.44 -    template <typename Target, typename Source>
    1.45 -    struct PathCopySelector<Target, Source, true, true> {
    1.46 +    struct PathCopySelectorBackward<Target, Source, true> {
    1.47        static void copy(Target& target, const Source& source) {
    1.48          target.clear();
    1.49          target.buildRev(source);
    1.50        }
    1.51      };
    1.52  
    1.53 +    
    1.54 +    template <typename Target, typename Source,
    1.55 +              bool revEnable = RevPathTagIndicator<Source>::value>
    1.56 +    struct PathCopySelector {
    1.57 +      static void copy(Target& target, const Source& source) {
    1.58 +        PathCopySelectorForward<Target, Source>::copy(target, source);
    1.59 +      }      
    1.60 +    };
    1.61 +
    1.62 +    template <typename Target, typename Source>
    1.63 +    struct PathCopySelector<Target, Source, true> {
    1.64 +      static void copy(Target& target, const Source& source) {
    1.65 +        PathCopySelectorBackward<Target, Source>::copy(target, source);
    1.66 +      }      
    1.67 +    };
    1.68 +
    1.69    }
    1.70  
    1.71