#ifdef _STR
# error _STR already defined
#endif
#define _STR(S) BOOST_METAPARSE_STRING(S){}
struct gps_position
{
field<int, (name=_STR("degrees"))> degrees;
field<int, (name=_STR("minutes"))> minutes;
field<float, (name=_STR("seconds"))> seconds;
};
We need to:
field<T, A> template class, this class is just a wrapper to T with std::reference_wrapper-like(??) iface.
name object with overloaded operator=(std::string_view), and this overloaded operator must be constexpr
This short example:
https://godbolt.org/z/nT4bdrnKc
Interface of field_t<T,A> class is not ideal, but this short example shows that structure with named fields are possible.
We need to:
field<T, A>template class, this class is just a wrapper to T withstd::reference_wrapper-like(??) iface.nameobject with overloadedoperator=(std::string_view), and this overloaded operator must be constexprThis short example:
https://godbolt.org/z/nT4bdrnKc
Interface of
field_t<T,A>class is not ideal, but this short example shows that structure with named fields are possible.