
31 Dec
2005
31 Dec
'05
8:15 p.m.
On Sat, 31 Dec 2005 09:15:39 +0300, Eric Niebler <eric@boost-consulting.com> wrote: []
template< typename T, std::size_t sz > const T* boost_range_end( const T (&array)[sz] )
const char* boost_range_end( const char* s )
The first is O(1) and the second is O(N) becuase it calls strlen. But the second will always be chosen because non-templates are preferred over templates.
It depends on a compiler. gcc replaces strlen() calls with a constant when called with a string literal.