I would like to try the new Hinnant short_alloc allocator , which, as I understand it, replaces the old stack_alloc . However, I cannot compile a vector example. g++ says:
~# g++ -std=c++11 stack-allocator-test.cpp -o stack-allocator-test In file included from stack-allocator-test.cpp:6:0: short_alloc.h:11:13: error: 'alignment' is not a type short_alloc.h:11:22: error: ISO C++ forbids declaration of 'alignas' with no type [-fpermissive] short_alloc.h:11:22: error: expected ';' at end of member declaration
As far as I can tell, g++ complains about line 10 and 11 :
static const std::size_t alignment = 16; alignas(alignment) char buf_[N];
It seems that the compiler does not like the "version of the expression" alignas , but it expects only a "version identifier type".
I am using g++ 4.7.2 under Ubuntu 12.10.
~
I guess I'm missing something obvious, but I can't figure it out. Any help would be greatly appreciated. (Please do not tell me that I need to switch to the new g++ , I'm too lazy to do this :)
source share