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 5: STLSoft access shims

Listing 5: STLSoft access shims

/* /////////////////////////////////////////////////////////////
 * Extract from stlsoft_string_access.h
 *
 * www:    http://stlsoft.org/
 *
 * Copyright (C) 2002, Synesis Software Pty Ltd.
 * (Licensed under the Synesis Software Standard Source License:
 *  http://www.synesis.com.au/licenses/ssssl.html)
 * ////////////////////////////////////////////////////////// */

namespace stlsoft
{
  /* C-style ANSI string */
  inline char const *c_str_ptr(char const *s)
  {
    return (s != 0) ? s : "";
  }
  /* C-style Unicode string */
  inline wchar_t const *c_str_ptr(wchar_t const *s)
  {
    return (s != 0) ? s : L"";
  }
  /* std::basic_string */
  template <class C>
  inline C const *c_str_ptr(std::basic_string<C> const &s)
  {
    return s.c_str();
  }
} // namespace stlsoft


Related Reading


More Insights