On Thu, May 24, 2012 at 3:16 AM, Richard Guenther
<[email protected]> wrote:
>> Some client code changes were needed:
>>
>> 1- The allocation names 'heap', 'stack' and 'gc' are not embedded in
>> the type name anymore. They are enum values used as a template
>> argument for functions like VEC_alloc() and VEC_free(). Since they
>> are now separate identifiers, some existing code that declared
>> variables with the names 'heap' and 'stack' had to change.
>>
>> I did not change these enum values to better names because that
>> would have meant changing a lot more client code. I will change
>> this in a future patch.
>
> Yeah. Can we have
>
> template <...>
> struct vec {
> enum { gc, heap, stack };
> ...
> }
>
> and use vec<T, vec::stack> instead? Not sure if this or something similar
> is valid C++.
It isn't valid. But, you probably want someting like
namespace store {
enum kind {
gc, heap, stack
}
}
template<typename T, store::kind k>
struct vec_t {
// ....
}
vec_t<T,store::gc>
or variations of this.
-- Gaby