accept rvalue tuples of lvalue references
Opened this issue · 2 comments
goertzenator commented
nifpp::get should accept an rvalue tuple consisting of lvalue references. Currently only lvalue tuples are accepted.
We want the following to work:
int a,b;
nifpp::get_throws(env, term, std::tie(a,b)); // crack {123, 456}
chrta commented
Please have a look: chrta/message_queuex@8a57b6a
This works with std:tie() and std::tuple().
goertzenator commented
I also have an uncommitted variation that implements rvalue tuples, but I think it had some limitations. Consider some of these wrinkles:
- What happens if the user provides an rvalue tuple that has something other than an lvalue referenence (ie, a value or rvalue reference)? The program should fail to compile in this case.
- What about nested rvalue tuples? This makes sense and should be supported, but as per #1 the compile should fail if any "leaf" node is not an lvalue reference.
I didn't try your code so I don't know how it holds up to the above properties, but I think I had some problems with them in my code. I'll have to take a closer look (and add unit tests) to see if either of us actually resolved them.