13 Apr
2012
13 Apr
'12
8:29 a.m.
I'm proposing a small boost library:
struct minimal_init {};
template <typename T>
struct minimal_constructible : public T
{
minimal_constructible() : T(minimal_init()) {}
};
The purpose of this is to enable vectors of simple structs (containing only POD members)
to have resize calling a do-nothing constructor. Let's say that I have a loop that I'd like to
calculate in parallel:
struct Dummy
{
Dummy(int a_=0) : a(a_) {}
Dummy(const minimal_init &) {} // Without a v-table, this shouldn't need to touch any part of the created object?
int a;
};
void foo()
{
#define N 100
std::vector