Dela via


CSimpleStringT::CSimpleStringT

Constructs a CSimpleStringT object.

CSimpleStringT( 
   const XCHAR* pchSrc, 
   int nLength, 
   IAtlStringMgr* pStringMgr 
); 
CSimpleStringT( 
   PCXSTR pszSrc, 
   IAtlStringMgr* pStringMgr 
); 
CSimpleStringT( 
   const CSimpleStringT& strSrc  
); 
explicit CSimpleStringT( 
   IAtlStringMgr* pStringMgr 
) throw( );

Parameters

  • strSrc
    An existing CSimpleStringT object to be copied into this CSimpleStringT object.

  • pchSrc
    A pointer to an array of characters of length nLength, not null terminated.

  • pszSrc
    A null-terminated string to be copied into this CSimpleStringT object.

  • nLength
    A count of the number of characters in pch.

  • pStringMgr
    A pointer to the memory manager of the CSimpleStringT object. For more information about IAtlStringMgr and memory management for CSimpleStringT, see Memory Management with CStringT.

Remarks

Construct a new CSimpleStringT object. Because the constructors copy the input data into new allocated storage, memory exceptions may result.

Example

The following example demonstrates CSimpleStringT::CSimpleStringT by using the ATL typedefCSimpleString. CSimpleString is a commonly used specialization of the class template CSimpleStringT.

A specialization defines a class by putting specific type parameters into a class template. For more information, see Class Template Instantiation.

CSimpleString s1(pMgr);                   // Empty string
CSimpleString s2(_T("cat"), pMgr);        // From a C string literal

CSimpleString s3(s2);                     // Copy constructor
CSimpleString s4(s2 + _T(" ") + s3);      // From a string expression

CSimpleString s5(_T("xxxxxx"), 6, pMgr);  // s5 = "xxxxxx"

Requirements

Header: atlsimpstr.h

See Also

Reference

CSimpleStringT Class

Other Resources

CSimpleStringT Members

Change History

Date

History

Reason

October 2009

Added a description of CSimpleStringT as a class template and CSimpleString as a typedef.

Customer feedback.