FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
June 01, 2004

Fast, Nonintrusive String Concatenation

(Page 4 of 9)
June, 2004: Fast, Nonintrusive String Concatenation

Listing 3

template< . . . >
size_t fast_string_concatenator<S, C, T>::length() const
{
  return m_lhs.length() + m_rhs.length();
}
template< . . . >
size_t fast_string_concatenator<S, C, T>::Data::length() const
{
  size_t len;
  assert( type == cstring || type == single || 
          type == concat || type == seed);
  switch(type)
  {
    case    seed:
      len = 0;
      break;
    case    single:
      len = 1;
      break;
    case    cstring:
      len = ref.cstring.len;
      break;
    case    concat:
      len = ref.concat->length();
      break;
  }
  return len;
}

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK