時間と日付を取得する関数群.
わりと標準ライブラリで良い感じはある.
#include <SDXFramework.h>
#include <Utility/Any.h>
#include <Utility/Pool.h>
#include <array>
class ITest
{
public:
int num;
virtual ~ITest() {}
};
class Test: public ITest
{
public:
Test& operator=(int value)
{
num = value;
return *this;
}
};
std::vector<int> a;
std::vector<int> b;
std::vector<int> c;
std::array<std::vector<int>*, 3> vecS = { &a,&b,&c };
bool SampleTime()
{
using namespace SDX;
int count = 0;
const int n1 = (int)std::ceil(std::log2(8));
const int n2 = (int)std::ceil(std::log2(9));
const int n3 = (int)std::ceil(std::log2(17));
std::vector<Test> vecA(1000);
std::vector<Any<ITest,sizeof(Test)+4>> vecB;
std::vector<std::shared_ptr<Test> > vecC;
std::vector<ITest*> vecD;
vecA.reserve(1000000);
vecB.reserve(1000000);
vecC.reserve(1000000);
vecD.reserve(1000000);
{
count++;
tm date;
for (int a = 0; a < 100; ++a)
{
}
for (int a = 0; a < 100; ++a)
{
}
for (int a = 0; a < 100000; ++a)
{
auto b = new Test();
delete b;
}
char c[1000000];
for (int a = 0; a < 1000000; ++a)
{
vecD.push_back(new(c + a / 100 * sizeof(Test)) Test());
}
vecD.clear();
for (int a = 0; a < 1000000; ++a)
{
vecD.push_back(pool.Get<Test>());
}
for (int a = 0; a < 1000000; ++a)
{
pool.Destroy( vecD[a] );
}
vecD.clear();
for (int a = 0; a < 1000000; ++a)
{
vecA.emplace_back();
}
vecA.clear();
for (int a = 0; a < 1000000; ++a)
{
vecC.push_back( std::make_shared<Test>() );
}
vecC.clear();
for (int a = 0; a < 1000000; ++a)
{
vecB.emplace_back( Test());
}
vecB.clear();
}
return true;
}