Simple integer range for C++11 range-based for loops
You can make the class template with trivial changes (add template&lt;typename T&gt; and change int by T in your classes), then make a construction function that deduces integer types:

template&lt;typename T&gt;
LoopRange&lt;T&gt; range(T from, T to)
{
    static_assert(std::is_integral&lt;T&gt;::value,
                  "range only accepts integral values");

    return { from, to };
}


That will even allow you to explicitly tell what kind of integer you want to loop with if needed:

for (auto i: range&lt;unsigned&gt;(0, 5))
{
    std::cout &lt;&lt; i &lt;&lt; " ";
}


If you need to generate indices to iterate through a std::vector, this can be useful since std::vector&lt;T&gt;::size_type is probably bigger than int. While the static_assert avoids some potential problems with floating point values, it also inhibits the use of integer-like classes (for example, a hypothetical BigNum class).



You can simplify some of your functions thanks to list initialization. For example, used in a return statement, it sallows you not to explicitly repeat the return type (unless the return type's constructor is explicit):

LoopRangeIterator begin() const
{
    return { from };
}

LoopRangeIterator end() const
{
    return { to };
}




On a side note, such a range utility would also be interesting if it worked with floating point numbers, and maybe decimal numbers in the future (akin to Python's numpy.arange). However, you would have to special-case the class for those types if you want to avoid problems: if you repeatedly add the same floating point (say 0.01), you will accumulate rounding errors. Computing every value from the base value with a multiplication could be away to circumvent such a problem.