pfr icon indicating copy to clipboard operation
pfr copied to clipboard

A small difference between `boost::pfr::get` and `std::get`

Open denzor200 opened this issue 3 years ago • 3 comments

As we know, std::get overloads for a std::tuple can't return values, it always returns a reference(https://en.cppreference.com/w/cpp/utility/tuple/get). This library shows itself as "tuple-like interface" and i suppose that boost::pfr::get must be fit to std::get in every detail. But i find that boost::pfr::get in some cases can return a value, and make a copy: https://godbolt.org/z/1GWaqsah4 Can we fix it? Or is it better not to touch it, to prevent a breaking change?

denzor200 avatar Aug 27 '22 05:08 denzor200

Looks like a bug. Could you please fix it and transform the godbolt snippet into a test?

apolukhin avatar Aug 31 '22 18:08 apolukhin

Looks like a bug. Could you please fix it and transform the godbolt snippet into a test?

Ok. I will fix it in the nearest future.

denzor200 avatar Sep 01 '22 07:09 denzor200

yet more in msvc: https://godbolt.org/z/rjEcdqssK it also spoils const references.

denzor200 avatar Jan 04 '23 06:01 denzor200