-
- PosToImplCache& cache = ms_cache;
- if ( this == cache.str )
- {
- if ( pos == cache.pos )
- return cache.impl;
-
- // TODO: is it worth complicating this function even further by going
- // backwards from the last position? it might be if we're just
- // before it...
- if ( cache.pos > pos )
- {
- cache.pos =
- cache.impl = 0;
- }
- }
- else // data for this string not cached
- {
- cache.str = this;
- cache.pos =
- cache.impl = 0;
- }
-
- wxStringImpl::const_iterator i(m_impl.begin() + cache.impl);
- for ( size_t n = cache.pos; n < pos; n++ )
- wxStringOperations::IncIter(i);
-
- cache.pos = pos;
- return cache.impl = i - m_impl.begin();
- }
-
- void InvalidatePosToImplCache()
- {
- PosToImplCache& cache = ms_cache;
- if ( cache.str == this )
- {
- cache.pos =
- cache.impl = 0;
- }