P
Protoman
Why won't the compiler let me write:
#include <iostream>
#include <cstdlib>
#include <new>
using namespace std;
template <class T>
class Allocator
{
public:
Allocator(){}
T* allocate(){static long long i=0; T* j=new(pool) T; i++; return
&*j;}
private:
static T pool[1000000];
};
int main()
{
Allocator<long long> alloc;
long long* i=alloc.allocate();
system("PAUSE");
return 0;
}
Any suggestions? Thanks.
#include <iostream>
#include <cstdlib>
#include <new>
using namespace std;
template <class T>
class Allocator
{
public:
Allocator(){}
T* allocate(){static long long i=0; T* j=new(pool) T; i++; return
&*j;}
private:
static T pool[1000000];
};
int main()
{
Allocator<long long> alloc;
long long* i=alloc.allocate();
system("PAUSE");
return 0;
}
Any suggestions? Thanks.