我想知道ATL的CPath是否像底層的CString一樣,在一個賦值將導致一個參考計數而不是一個深度拷貝。我在檔案中沒有看到任何關于它的內容,我也不確定如何測驗它。 這里有一些可能與之相關的資料,盡管我不確定:
template< typename StringType >
class CPathT
{
public:
typedef typename StringType::XCHAR XCHAR。
typedef typename StringType::PCXSTR PCXSTR;
typedef typename StringType::PXSTR PXSTR;
public:
CPathT() throw()
{
}
CPathT(_In_ const CPathT< StringType > & path) 。
m_strPath( path.m_strPath )
{
}
CPathT(_In_z_ PCXSTR pszPath) :
m_strPath( pszPath )
{
}
operator const StringType& () const throw( )
{
return m_strPath。
}
operator StringType& () throw()
{
return m_strPath;
}
operator PCXSTR() const throw()
{
return m_strPath。
}
...
public:
StringType m_strPath。
};
typedef CPathT< CString > CPath;
非常感謝你的任何資訊。
uj5u.com熱心網友回復:
正如你在上面的代碼中所示,CPath只是CString的一個封裝器,所以它封裝了它的所有屬性和行為。從邏輯上講,它使用CString reference count.
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/331303.html
標籤:
