创新+实践
template <class T>struct SharedData { T m_pData[DATACENTER_CACHE]; T m_kCloneData; int m_iIndex; SharedData() { ZeroMemory( m_pData, DATACENTER_CACHE * sizeof(T) ); m_iIndex = 0; } void Write( T& rData ) { int iNewIndex = m_iIndex == DATACENTER_CACHE - 1 ? 0 : m_iIndex + 1; m_pData[iNewIndex] = rData; m_iIndex = iNewIndex; } T& Read() { return m_pVector[m_iIndex]; } void Set() { m_kCloneData = Read(); } T& Get() { return m_kCloneData; } };
Copyright @ flagship Powered by: .Text and ASP.NET Theme by: .NET Monster