Let's say that I have an std::tuple:
std::tuple< int, float, bool > my_tuple;
and a function:
void my_function( int& i, float& f, bool& b);
Is it possible to retrieve the my_tuple
object from within my_function
if I can guarantee that its arguments i, f, b
are members of my_tuple
?
For example - is it legal to:
void my_function( int& i, float& f, bool& b){
using tuple_type = std::tupl< int, float, bool >;
tuple_type& my_tuple = *reinterpret_cast<tuple_type*>(reinterpret_cast<void*>(&i))
// do stuff with my_tuple, like call its copy constructor, etc
}