#include <iostream>
#include <type_traits>
struct A
{
A() : i1(42), i2(i1) {}
int i1;
int& i2;
int* i3;
};
template<typename T>
static constexpr bool is_value()
{
return !std::is_reference_v<T> && !std::is_pointer_v<T>;
}
template<typename T>
auto Field(const T& value) -> std::enable_if_t<is_value<T>(),void>
{
std::cout << "Handling field : " << value;
}
#define FIELD(x) Field<decltype(x)>(x);
int main()
{
A a;
FIELD(a.i1);
FIELD(a.i2); //<== will not compile
// FIELD(a.i3); //<== will not compile
return 0;
}