nifpp icon indicating copy to clipboard operation
nifpp copied to clipboard

accept rvalue tuples of lvalue references

Open goertzenator opened this issue 9 years ago • 2 comments

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}

goertzenator avatar Sep 17 '14 20:09 goertzenator

Please have a look: https://github.com/chrta/message_queuex/commit/8a57b6aabf796814b9bf795fc727323d7a6cc652

This works with std:tie() and std::tuple().

chrta avatar Aug 11 '15 14:08 chrta

I also have an uncommitted variation that implements rvalue tuples, but I think it had some limitations. Consider some of these wrinkles:

  1. 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.
  2. 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.

goertzenator avatar Aug 11 '15 15:08 goertzenator