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>
|
<ProjectGuid>{5FE98B77-3558-4384-BDAF-82AC8B69B752}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>String</RootNamespace>
|
<RootNamespace>String</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
<ProjectName>LSFramework</ProjectName>
|
<ProjectName>LSFramework</ProjectName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define DELETE_POINTER(Pointer) \
|
#define DELETE_POINTER(pPointer) \
|
||||||
if (Pointer != nullptr)\
|
if (pPointer != nullptr)\
|
||||||
{\
|
{\
|
||||||
delete Pointer;\
|
delete pPointer;\
|
||||||
Pointer = nullptr;\
|
pPointer = nullptr;\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DELETE_ARRAY(Array) \
|
#define DELETE_ARRAY(vArray) \
|
||||||
if (Array != nullptr)\
|
if (vArray != nullptr)\
|
||||||
{\
|
{\
|
||||||
delete[] Array;\
|
delete[] vArray;\
|
||||||
Array = nullptr;\
|
vArray = nullptr;\
|
||||||
}
|
}
|
|
@ -1,17 +1,92 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <vector>
|
||||||
|
#include "LSMacros.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|
||||||
class LSVector
|
class LSVector
|
||||||
{
|
{
|
||||||
LSVector()
|
public:
|
||||||
|
LSVector(size_t zSize = 1)
|
||||||
{
|
{
|
||||||
|
m_pData = new T[zSize];
|
||||||
|
m_zCapacity = zSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
~LSVector()
|
~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