started vector
This commit is contained in:
parent
9bcf266ce2
commit
c4b3d8ac5f
3 changed files with 91 additions and 16 deletions
|
@ -23,33 +23,33 @@
|
|||
<ProjectGuid>{5FE98B77-3558-4384-BDAF-82AC8B69B752}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>String</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<ProjectName>LSFramework</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#define DELETE_POINTER(Pointer) \
|
||||
if (Pointer != nullptr)\
|
||||
#define DELETE_POINTER(pPointer) \
|
||||
if (pPointer != nullptr)\
|
||||
{\
|
||||
delete Pointer;\
|
||||
Pointer = nullptr;\
|
||||
delete pPointer;\
|
||||
pPointer = nullptr;\
|
||||
}
|
||||
|
||||
#define DELETE_ARRAY(Array) \
|
||||
if (Array != nullptr)\
|
||||
#define DELETE_ARRAY(vArray) \
|
||||
if (vArray != nullptr)\
|
||||
{\
|
||||
delete[] Array;\
|
||||
Array = nullptr;\
|
||||
delete[] vArray;\
|
||||
vArray = nullptr;\
|
||||
}
|
|
@ -1,17 +1,92 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
#include "LSMacros.h"
|
||||
|
||||
template <class T>
|
||||
|
||||
class LSVector
|
||||
{
|
||||
LSVector()
|
||||
public:
|
||||
LSVector(size_t zSize = 1)
|
||||
{
|
||||
|
||||
m_pData = new T[zSize];
|
||||
m_zCapacity = zSize;
|
||||
}
|
||||
|
||||
~LSVector()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
T& PushBack(T obj)
|
||||
{
|
||||
}
|
||||
|
||||
T& PopBack()
|
||||
{
|
||||
}
|
||||
|
||||
T& Insert(const size_t zPos)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
T& Remove(const size_t zPos)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
T& At(const size_t zPos)
|
||||
{
|
||||
return m_pData[zPos];
|
||||
}
|
||||
|
||||
void Reserve(const size_t zSize)
|
||||
{
|
||||
T* pOld = m_pData;
|
||||
m_pData = new T[zSize];
|
||||
|
||||
memmove_s(m_pData, zSize, pOld, m_zSize);
|
||||
m_zSize = zSize;
|
||||
m_zCapacity = zSize;
|
||||
|
||||
DELETE_ARRAY(pOld);
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
DELETE_ARRAY(m_pData)
|
||||
}
|
||||
|
||||
size_t Size() const
|
||||
{
|
||||
return m_zSize;
|
||||
}
|
||||
|
||||
size_t Capacity() const
|
||||
{
|
||||
return m_zCapacity;
|
||||
}
|
||||
|
||||
T* Data() const
|
||||
{
|
||||
return m_pData;
|
||||
}
|
||||
|
||||
LSVector& operator=(const LSVector oRhs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
LSVector& operator[](const size_t _Pos)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::vector<int> s;
|
||||
T* m_pData = nullptr;
|
||||
size_t m_zSize = 0;
|
||||
size_t m_zCapacity = 0;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue