Listing 1

template
template< typename C                       // Character type
        , typename T = std::char_traits<C> // Traits
        , typename A = std::allocator<C>   // Allocator
        >
class basic_string_view
  : private A
{
public: // Types
  typedef C                           value_type;
  typedef basic_string_view<C, T, A>  class_type;
  . . .
  typedef value_type const            &const_reference;
public: // Construction
  basic_string_view();
  basic_string_view(class_type const &rhs);
  basic_string_view(class_type const &s, size_type pos);
  basic_string_view(class_type const &s, size_type pos, size_type cch);
  basic_string_view(char_type const *s);
  basic_string_view(char_type const *s, size_type cch);
  basic_string_view(char_type const *first, char_type const *last);
  ~basic_string_view() throw();
  class_type &operator =(class_type const &rhs);
public: // Operations
  void  swap(class_type &other) throw();
  void  clear() throw();
  void  refresh() throw();
public: // Attributes
  size_type        size() const throw();
  size_type        length() const throw();
  static size_type max_size() throw();
  allocator_type   get_allocator() const;
  . . .
public: // Comparison
  bool equal(class_type const &rhs) const throw();
  bool equal(value_type const *rhs, size_type cchRhs) const throw();
  int compare(size_type pos, size_type cch
            , value_type const *s, size_type cchRhs) const throw();
  int compare(size_type pos, size_type cch
	   , value_type const *s) const throw();
  int compare(value_type const *s) const throw();
  int compare(size_type pos, size_type cch, class_type const &rhs
            , size_type posRhs, size_type cchRhs) const throw();
  int compare(size_type pos, size_type cch
	  , class_type const &rhs) const throw();
  int compare(class_type const &rhs) const throw();
public: // Accessors
  const_reference         operator [](size_type index) const;
  value_type const        *c_str() const;
  value_type const        *data() const throw();
  value_type const        *base() const throw();
  const_reference         front() const;
  const_reference         back() const;
  size_type               copy( value_type *dest, size_type cch
                              , size_type pos = 0) const throw();
public: // Iteration
  const_iterator          begin() const;
  const_iterator          end() const;
  const_reverse_iterator  rbegin() const;
  const_reverse_iterator  rend() const;
private: // Invariant
  bool  is_valid() const;
private: // Implementation
  static char_type const *empty_string_() throw();
  static int       compare_(char_type const *lhs, size_type lhs_len
                          , char_type const *rhs, size_type rhs_len);
private: // Members
  size_type         m_length;
  char_type const   *m_base;
  mutable char_type *m_cstr;
};

// and comparison operators ==, !=, <, <=, >, >=
template<   typename C
        ,   typename T
        ,   typename A
        >
bool operator ==(basic_string_view<C, T, A> const &lhs 	      , basic_string_view<C, T, A> const &rhs);
// ... and overloads for C const *.