|
-
March 6th, 2012, 12:04 PM
#6
Re: Custom allocator problems
 Originally Posted by JohnW@Wessex
Here's a demo that compiles correctly with both VS2008 & VS2010, but exceptions under VS2010.
I didn't test it, but wouldn't the solution be to take the buffer out of the allocator? Something like
Code:
int main()
{
const size_t MAX_SIZE = 1024; // bytes
char buffer[MAX_SIZE];
std::vector<int, ArrayAllocator<int, MAX_SIZE>> test(
ArrayAllocator<int, MAX_SIZE>(buffer));
//...
}
where the buffer is passed to the allocator's constructor.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|