new CollectionTest
This commit is contained in:
parent
af53db0a64
commit
2d6d76ab6d
@ -5,9 +5,16 @@
|
|||||||
using namespace hgl;
|
using namespace hgl;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
void out(const Collection<uint32> &c)
|
using TEST_TYPE =uint32;
|
||||||
|
using MyEnumerator=ElementEnumerator<TEST_TYPE>;
|
||||||
|
using MyOperator =ElementOperatorRawtype<TEST_TYPE>;
|
||||||
|
constexpr size_t UNIT_BYTES =sizeof(TEST_TYPE);
|
||||||
|
|
||||||
|
void out(const Collection &c)
|
||||||
{
|
{
|
||||||
for(const uint32 &value:c)
|
MyEnumerator me(&c);
|
||||||
|
|
||||||
|
for(const TEST_TYPE &value:me)
|
||||||
std::cout<<value<<" ";
|
std::cout<<value<<" ";
|
||||||
|
|
||||||
std::cout<<std::endl;
|
std::cout<<std::endl;
|
||||||
@ -15,16 +22,15 @@ void out(const Collection<uint32> &c)
|
|||||||
|
|
||||||
void main(int,char **)
|
void main(int,char **)
|
||||||
{
|
{
|
||||||
{
|
MyOperator my_operator;
|
||||||
MemoryAllocator *ma=new MemoryAllocator;
|
MemoryAllocator *ma=new MemoryAllocator;
|
||||||
|
|
||||||
ma->Alloc(1024);
|
ma->Alloc(1024*UNIT_BYTES);
|
||||||
|
|
||||||
MemoryBlock mb(ma);
|
MemoryBlock *mb=new MemoryBlock(ma);
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Collection<uint32> cu;
|
Collection cu(UNIT_BYTES,mb,&my_operator);
|
||||||
|
|
||||||
for(uint i=0;i<20;i++)
|
for(uint i=0;i<20;i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user