Started work on Smart Pointer Vectors (SPVs).

This commit is contained in:
Arron David Nelson 2024-12-02 16:19:50 -08:00
parent 7bc4b9977d
commit 32f91ead4e
5 changed files with 61 additions and 0 deletions

View File

@ -82,6 +82,8 @@ set(EHS_SOURCES
include/ehs/UniPtr.h include/ehs/UniPtr.h
include/ehs/ShdPtr.h include/ehs/ShdPtr.h
include/ehs/WkPtr.h include/ehs/WkPtr.h
include/ehs/SPV.h
include/ehs/SPVE.h
src/db/DbVarTmpl.cpp include/ehs/db/DbVarTmpl.h src/db/DbVarTmpl.cpp include/ehs/db/DbVarTmpl.h
@ -187,6 +189,8 @@ set(EHS_SOURCES
include/ehs/io/Directory.h include/ehs/io/Directory.h
include/ehs/io/socket/ehc/NetEnc.h include/ehs/io/socket/ehc/NetEnc.h
src/io/socket/ehc/NetEnc.cpp src/io/socket/ehc/NetEnc.cpp
src/SPVE.cpp
src/SPV.cpp
) )
if (IS_OS_WINDOWS) if (IS_OS_WINDOWS)

26
include/ehs/SPV.h Normal file
View File

@ -0,0 +1,26 @@
#pragma once
#include "Types.h"
namespace ehs
{
template <typename T>
class SPVE;
template <typename T>
class SPV
{
private:
Size size;
Size rawSize;
Size stride;
T *data;
public:
SPV();
SPVE<T> operator[](Size index)
{
return SPVE<T>(data[index]);
}
};
}

25
include/ehs/SPVE.h Normal file
View File

@ -0,0 +1,25 @@
#pragma once
namespace ehs
{
template <typename T>
class SPVE
{
private:
SPV *owner;
T *value;
public:
SPVE();
SPVE(T *value);
SPVE(SPVE &&spve) noexcept;
SPVE(const SPVE &spve);
SPVE &operator=(SPVE &&spve) noexcept;
SPVE &operator=(const SPVE &spve);
};
}

3
src/SPV.cpp Normal file
View File

@ -0,0 +1,3 @@
//
// Created by Arron Nelson on 12/2/2024.
//

3
src/SPVE.cpp Normal file
View File

@ -0,0 +1,3 @@
//
// Created by Arron Nelson on 12/2/2024.
//