A
aaragon
Hello everyone,
Is this valid?
template <class A>
struct ClassA {
typedef A value_type;
value_type* data_;
explicit ClassA(size_t n) : data(new value_type[]()) {} // note
the () after []
// other stuff
};
Here A is any type, including primitive types. I run valgrind on this
code and it gives me the "Conditional jump or move depends on
uninitialised value(s)" error. So if it is not valid, why is it? Is
there a way to default initialize the array in the initialization
list?
Thank you all,
aa
Is this valid?
template <class A>
struct ClassA {
typedef A value_type;
value_type* data_;
explicit ClassA(size_t n) : data(new value_type[]()) {} // note
the () after []
// other stuff
};
Here A is any type, including primitive types. I run valgrind on this
code and it gives me the "Conditional jump or move depends on
uninitialised value(s)" error. So if it is not valid, why is it? Is
there a way to default initialize the array in the initialization
list?
Thank you all,
aa