I have a lot of code in a large project that has two common types of code, some of which run in good C ++ style and were reviewed by an expert in C ++, and some do not and do not. Code that does not have much for loops and uncontrolled arrays (heaps), which consist of both read and write. Fortunately, all these heap calls are done through the class. For argument, let me call it CArray.
CArrayfully defined in the header files since its inception. It is roughly defined as follows (only with the indication of the relevant parts):
template <typename elementType> class CArray
{
public:
inline elementType & operator[](unsigned int i)
{
#ifdef CARRAY_BOUNDARY_DEBUGGING
if(i >= m_numElements)
{
throw SomeException("CArray::operator[] going out of bounds");
}
#endif
return m_pArray[i];
}
private:
elementType *m_pArray;
int m_numElements;
}
(, , , , rvalue . , , , .
: (.cpp files), CARRAY_BOUNDARY_DEBUGGING, (, / ), , (, ):
, , , , , rvalue refrence ( ++ 11) ++ 03? ++ 11?
?
: . , non inline , 3.2 ++ 03, inline. ODR - ? ++ 03 " , ".