| | 97 | |
| | 98 | template <typename I1, typename I2> |
| | 99 | struct distance; |
| | 100 | |
| | 101 | // detail |
| | 102 | template <typename I1, typename I2> |
| | 103 | struct lazy_next_distance |
| | 104 | { |
| | 105 | typedef |
| | 106 | typename mpl::plus< |
| | 107 | mpl::int_<1>, |
| | 108 | typename distance< |
| | 109 | typename next<I1>::type, |
| | 110 | I2 |
| | 111 | >::type |
| | 112 | >::type type; |
| | 113 | }; |
| | 114 | |
| | 115 | template <typename I1, typename I2> |
| | 116 | struct distance |
| | 117 | { |
| | 118 | typedef typename mpl::eval_if< |
| | 119 | boost::is_same<I1, I2>, |
| | 120 | mpl::int_<0>, |
| | 121 | lazy_next_distance<I1, I2> |
| | 122 | >::type type; |
| | 123 | |
| | 124 | static type |
| | 125 | call(I1 const&, I2 const&) |
| | 126 | { |
| | 127 | return type(); |
| | 128 | } |
| | 129 | }; |