Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Welcome Guest | Log In | Register | Benefits
Channels ▼
RSS

Generalized String Manipulation: Access Shims and Type Tunneling


Listing 2: Adaptive veneer: emulating standard string

Listing 2: Adaptive veneer: emulating standard string

template <typename S>
class c_str_veneer
  : public S
  , is_veneer<S, c_str_veneer<S> >
{
public:
  typedef S                       parent_class_type;
  typedef typename S::value_type  value_type;

  // Other methods, including constructors
  ...

  value_type const *c_str() const;
};

template <>
inline LPCTSTR c_str_veneer<CString>::c_str() const
{
  return *this;
}


Related Reading


More Insights