Well, it wasn't as bad as I thought. First of all, I had munged the template, and didn't
know that's where the errors were coming from. Corrected, I have
inline boost::iterator_range measure_fixed (CharT* p, std::size_t capacity)
{
// The deduced CharT will include the const if called on a const array.
CharT* found= std::find (p, p+capacity, CharT(0));
return boost::iterator_range (p, found);
}
and then the main function works when declared with references:
template <typename T>
size_t Strlen (const T& s)
{
return internal::Strlen (internal::as_literal(s));
}
This blew up originally, so I wrote it as pass-by-value. It turns out that I was getting
a fit from the compiler when the interesting form _was_ being used.
Without &&, I still hope to keep proliferation of arguments down to a minimum because
input arguments can simply always be const, and output arguments never are.
—John