我有一个getDescriptor
有两个重载的函数模板。它们具有以下签名:
template <class _DescriptorType>
typename _DescriptorType::FeatureType getDescriptor
(const View & view, const _DescriptorType & desc);
和
template <class _DescriptorType>
typename _DescriptorType::FeatureType getDescriptor
(const Instance & instance, const _DescriptorType & desc);
我有一个不同的函数模板getEncoding
其中我需要第一个getDescriptor
函数的地址,以及来自 getEncoding
的_DescriptorType
:
template <class _DescriptorType>
Encoding getEncoding()
{
auto ptr = static_cast<...>(getDescriptor);
...
}
我需要在static_cast
中输入什么才能获取第二个重载getDescriptor
模板的地址,并将_DescriptorType
设置为 getEncoding
之一?
你去吧:
auto ptr = static_cast<
typename _DescriptorType::FeatureType (*)(const Instance &, const _DescriptorType &)
>(getDescriptor<_DescriptorType>);