How does one generally get the end of a string in C++0x?
<pre><code>template&lt;typename ForwardIterator, typename StringType&gt;
inline bool starts_with(ForwardIterator begin, ForwardIterator end, const StringType&amp; target)
{
    assert(begin &lt; end);
    if (std::distance(std::begin(target), std::end(target)) &gt; std::distance(begin, end))
    {
        return false;
    }
    return std::equal(std::begin(target), std::end(target), begin);
}
</code></pre>

<p>This fails because <code>std::end</code> returns one past the <code>'\0'</code> if <code>StringType</code> is a string literal, not the <code>'\0'</code>. (In this respect, it's similar to the <a href="http://stackoverflow.com/questions/6727412/inconsistency-between-stdstring-and-string-literals">range based for loop inconsistency</a> ) How does one work around this?</p>
