static decltype(auto) Get(XML_Serializer& arcSer)
{
return TDataConverter<TDataConverterAttribute>::Get(arcSer, DT_TypeDescriptor::Instance().GetAttribute<TVal, DT_DataConverterAttribute>());
};
typedef typename DT_TypeManipulation::RemoveReference<decltype(Get(*reinterpret_cast<XML_Serializer*>(NULL)))>::Result Type;
不适用于C ++ 14(Visual Stdio 2017 / C ++ 17)
错误C3779:“ XML_TDataConverterProvider :: Get”:返回“ decltype(auto)”的函数在定义之前不能使用
template<class TVal>
class XML_TDataConverterProvider
{
private:
template<class TDataConverterAttribute>
struct TDataConverter
{
static auto Get(XML_Serializer& arcSer, TDataConverterAttribute apcDataConverterAttribute)
-> decltype(apcDataConverterAttribute->GetDataConverter())
{
ASSERT(apcDataConverterAttribute);
return apcDataConverterAttribute->GetDataConverter();
}
};
template<>
struct TDataConverter<DT_DataConverterAttribute const* const>
{
static DT_DataConverter& Get(XML_Serializer& arcSer, DT_DataConverterAttribute const* const apcDataConverterAttribute)
{
ASSERT(!apcDataConverterAttribute);
if (apcDataConverterAttribute) {}
return arcSer.mcConv;
}
};
typedef decltype(DT_TypeDescriptor::Instance().GetAttribute<TVal, DT_DataConverterAttribute>()) TDataConverterAttribute;
public:
static auto Get(XML_Serializer& arcSer)
-> decltype(TDataConverter<TDataConverterAttribute>::Get(arcSer, DT_TypeDescriptor::Instance().GetAttribute<TVal, DT_DataConverterAttribute>()))
{
return TDataConverter<TDataConverterAttribute>::Get(arcSer, DT_TypeDescriptor::Instance().GetAttribute<TVal, DT_DataConverterAttribute>());
};
typedef typename DT_TypeManipulation::RemoveReference<decltype(Get(*reinterpret_cast<XML_Serializer*>(NULL)))>::Result Type;
};
并且正在Visual Studio 2012 / C ++ 11中运行
要运行此代码,在C ++ 11代码中做了什么更改?