Skip to content

Commit

Permalink
Fixed warning about negative unsigned values
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Nov 21, 2015
1 parent 57a41b5 commit 72a2019
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions include/tao/seq/make_integer_range.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@ namespace tao
{
namespace impl
{
template< typename T, T Begin, T Steps, T Delta, typename = make_integer_sequence< T, Steps > >
template< typename T, T Begin, T Steps, bool Increase, T Delta = T( 1 ), typename = make_integer_sequence< T, Steps > >
struct generate_range;

template< typename T, T B, T S, T D, T... Ns >
struct generate_range< T, B, S, D, integer_sequence< T, Ns... > >
struct generate_range< T, B, S, true, D, integer_sequence< T, Ns... > >
{
using type = integer_sequence< T, B + D * Ns... >;
};

template< typename T, T B, T S, T D, T... Ns >
struct generate_range< T, B, S, false, D, integer_sequence< T, Ns... > >
{
using type = integer_sequence< T, B - D * Ns... >;
};
}

template< typename T, T N, T M >
using make_integer_range = typename impl::generate_range< T, N, ( N <= M ) ? ( M - N ) : ( N - M ), ( N <= M ) ? 1 : -1 >::type;
using make_integer_range = typename impl::generate_range< T, N, ( N <= M ) ? ( M - N ) : ( N - M ), ( N <= M ) >::type;

template< std::size_t N, std::size_t M >
using make_index_range = make_integer_range< std::size_t, N, M >;
Expand Down

0 comments on commit 72a2019

Please sign in to comment.