The following c++ code compiles and works with Visual Studio 2017, but gives error "expected primary-expression before '>' token" with gcc 5.0. Any idea why? Description is a struct, and Description::add is a function template.
template <class X>
struct DataPoint
{
X value;
DataPoint()
: value(0.) {}
DataPoint( X value )
: value(value) {}
static void describe(Description< DataPoint<X> > & desc)
{
desc.add<X>("f", ".", offsetof(DataPoint<X>, value));
}
}
In fact VS doesn't even complain when the DataPoint template type is not specified:
static void describe(Description<DataPoint> & desc)
{
desc.add<X>("f", ".", offsetof(DataPoint, value));
}