The static_assert
fails because std::mem_fn(&Device::Version)
returns a function object that returns a reference (std::string&
), not a value, so the correct type is std::string&
; fix it by changing the assertion to static_assert(std::is_same_v<Field, std::string&>)
.