// bind function:
template<typename T> T bind(T& v)
{
// Can I toy with the object v refers to? or that's undefined behaviour?
// the object v refers to is not initialized yet, But the object has been allocated, so I can use that memory, I think?
// The following 2 lines should be fine if I'm correct.
// Which is my function is currently is doing (sorta)
myvector.emplace_back(SQLType<T>(), (void*)&v);
return 0;
}
SomeClass value = bind(value);
I would like to know if I can use the objectvalue
before it has been initialized (which would happen when the bind
function returns).
1 - Can I initialize the object myself and use it ? ie:
v = T();
v.something(); // if T is a class
2 - Or can I use the memory where it's stored? ie: as a temp raw buffer?
if (sizeof(v) > 4)
{
((char*)&v)[0] = 1;
((char*)&v)[1] = e + 5;
}