Open alexey-malov opened 5 years ago
1>c:\teaching\oop-2019\yambakov\oop\lab5\mystring\cmystring.cpp(10): warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
int CompareStrings(const CMyString& a, const CMyString& b)
{
size_t aLen = a.GetLength();
size_t bLen = b.GetLength();
int result = memcmp(a.GetStringData(), b.GetStringData(), std::min(aLen, bLen));
return (result == 0) ? (aLen - bLen) : result;
}
CMyString::CMyString(CMyString&& other)
{
m_string = std::move(other.m_string);
m_size = std::move(other.m_size);
other.m_string = nullptr;
}
void CMyString::Clear()
{
delete[] m_string;
m_string = new char[1]{ "" };
m_size = 0;
}
CMyString operator+(const CMyString& a, const CMyString& b)
{
CMyString result(a);
result.Append(b);
return result;
}
bool operator==(const CMyString& a, const CMyString& b)
{
return CompareStrings(a, b) == 0;
}
bool operator==(const CMyString& a, const CMyString& b)
{
return true;
//CompareStrings(a, b) == 0;
}
bool operator!=(const CMyString& a, const CMyString& b)
{
return true; //!(a == b);
}
bool operator<(const CMyString& a, const CMyString& b)
{
return true;
//CompareStrings(a, b) < 0;
}
bool operator>(const CMyString& a, const CMyString& b)
{
return true;
//CompareStrings(a, b) > 0;
}
bool operator<=(const CMyString& a, const CMyString& b)
{
return true;
//!(CompareStrings(a, b) > 0);
}
bool operator>=(const CMyString& a, const CMyString& b)
{
return true;
//!(CompareStrings(a, b) < 0);
}
template <typename Type>
inline bool CMyStringIterator<Type>::operator>(const CMyStringIterator& it) const
{
return true; // m_ch > it.m_ch;
}
template <typename Type>
inline bool CMyStringIterator<Type>::operator<(const CMyStringIterator& it) const
{
return true; //m_ch < it.m_ch;
}
template <typename Type>
inline bool CMyStringIterator<Type>::operator>=(const CMyStringIterator& it) const
{
return true; //m_ch >= it.m_ch;
}
template <typename Type>
inline bool CMyStringIterator<Type>::operator<=(const CMyStringIterator& it) const
{
return true; //m_ch <= it.m_ch;
}