|
|
支持vc6和vs.net。在2008下产生C2923。
似乎是原有hetero_stack::stack_node::header结构现在不能看作类型了。
将原有code
struct stack_node{ struct header { stack_node * m_back; stack_node * m_next; byte_t * m_current; // ptr into m_mem. alloc from here byte_t * m_end; // ptr to last+1 byte_t in m_mem }; union { header m_head; byte_t m_align[ aligned_sizeof<header>::no_rtti ]; }; // This is the buffer into which values will be pushed and popped. // It is guaranteed to meet the AlignmentT requirements because of // the union above. byte_t m_mem[1]; size_t size() const // throw() { return static_cast<size_t>( m_head.m_end - m_mem ); }};
改为
struct stack_node_header;struct stack_node{ union { stack_node_header m_head; byte_t m_align[ aligned_sizeof<stack_node_header>::no_rtti ]; }; // This is the buffer into which values will be pushed and popped. // It is guaranteed to meet the AlignmentT requirements because of // the union above. byte_t m_mem[1]; size_t size() const // throw() { return static_cast<size_t>( m_head.m_end - m_mem ); }};struct stack_node_header{ stack_node * m_back; stack_node * m_next; byte_t * m_current; // ptr into m_mem. alloc from here byte_t * m_end; // ptr to last+1 byte_t in m_mem};
并将引用:
byte_t m_buf[ aligned_sizeof<stack_node::header>::no_rtti + StaticBlockSizeT ];
改为:
byte_t m_buf[ aligned_sizeof<stack_node_header>::no_rtti + StaticBlockSizeT ];
编译通过。 |
|