Closed BaLiKfromUA closed 2 months ago
I created this PR to receive feedback about my current progress while I am dealing with new implementation of #11 .
I tried to cover 3 main cases mentioned in the issue but will come back and add more tests later.
Plus, need to investigate needs for changes of related functions -- type_of
, extract
Thanks for the initial review! I will work on testing and adapting type_of
and extract
implementations.
So far, at least type_of
implementation is definetely needs few small changes.
After my test&fixes, I'll request your review again + meanwhile will investigate which implemented functions might need some changes
I think I am ready for next iteration of review. I slightly changed implementations of type_of
and extract
functions.
One remark about my changes: I am not sure about my changes to extract
function because I didn't come up with all relevant test cases. My current tests are inspired by tests from to-and-from-values.pass.cpp
.
constexpr auto p = std::pair{1, 2};
auto& [x4, y4] = p;
static_assert(extract<int>(^x4) == x4);
static_assert(extract<int&>(^x4) == x4);
static_assert(&extract<int&>(^x4) == &x4);
static_assert(extract<int>(^y4) == y4);
static_assert(extract<int&>(^y4) == y4);
static_assert(&extract<int&>(^y4) == &y4);
I think I am ready for next iteration of review. I slightly changed implementations of
type_of
andextract
functions.One remark about my changes: I am not sure about my changes to
extract
function because I didn't come up with all relevant test cases. My current tests are inspired by tests fromto-and-from-values.pass.cpp
.constexpr auto p = std::pair{1, 2}; auto& [x4, y4] = p; static_assert(extract<int>(^x4) == x4); static_assert(extract<int&>(^x4) == x4); static_assert(&extract<int&>(^x4) == &x4); static_assert(extract<int>(^y4) == y4); static_assert(extract<int&>(^y4) == y4); static_assert(&extract<int&>(^y4) == &y4);
Valentyn, I think these look great! Note that it hasn't been decided yet whether to support extract
or type_of
on structured bindings for P2996 (though the current wording for type_of
seems like it would support it). Let's keep this for now though. Your changes will be on public godbolt tomorrow, so please feel free to poke and prod the APIs; let me know if anything looks wrong or crashes.
Thanks so much for the contribution!!
Implements #44
Describe your changes
Added implementation of
is_structured_binding
+ adapted implementation oftype_of
andextract
functionsTesting performed
Added tests for my changes to
entity-classification.pass.cpp