Listing 6



bool basic_string_view::is_valid() const
{
  if( 0 != m_length &&
      NULL == m_base)
  {
    return false; // If slice is nonempty, m_base should be !NULL
  }
  if( 0 == m_length &&
      NULL != m_cstr)
  {
    return false; // If slice is empty, should be no m_cstr
  }
  return true;
};