Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2005-12-31 12:36:12

Sebastian Redl wrote:
> Eric Niebler wrote:
>>That only works on compilers that handle SFINAE. Probably the easiest
>>thing would be to remove the char* overloads and modify the "primary"
>>boost_range_end(T const &) overload, which currently only works when T
>>is an STL container, to use is_pointer<T> to dispatch to str_end().
> What if the non-template overload would be replaced by a template overload?
> template<>
> const char* boost_range_end( const char* s )
> Wouldn't that work? I know of a similar (but much less complex) case
> where this solved the overload resolution problem.

Did you try it? What you've shown is a function template specialization,
not an overload, but it won't work, because it doesn't match any primary
template. You could've written const char*&, but for completeness, you'd
also have to provide overloads for char*&, char*const&, const
char*const&, and all the wchar_t variants. That's a lot.

Now that I think about it, we had discussed eliminating the inconsistent
  "boost::size(int[5])==5, but boost::size(char[5])==4" behavior. Bugs
aside, why is it still there? Thorsten?

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at