我有一个模板类,我米试图显式实例的显式模板实例:C++操作
template<T>
struct tmat2x3
{
...
typedef tvec3<T> col_type;
..
};
操作声明如下:
template <typename T>
typename tmat2x3<T>::row_type operator* (tmat2x4<T> const & m, typename tmat2x3<T>::col_type const & v);
我明确实例化操作使用以下内容:
template tmat2x3<unsigned char>::row_type operator * (tmat2x3<unsigned char> const &m, tmat2x3<unsigned char>::col_type const &s);
gcc给我以下错误:但是:
../glm/glm_core.cpp: In instantiation of ‘typename glm::detail::tmat2x3<T>::row_type glm::detail::operator*(const glm::detail::tmat2x3<T>&, const typename glm::detail::tmat2x3<T>::col_type&) [with T = unsigned char]’:
../glm/glm_core.cpp:443: instantiated from here
../glm/glm_core.cpp:443: error: explicit instantiation of ‘typename glm::detail::tmat2x3<T>::row_type glm::detail::operator*(const glm::detail::tmat2x3<T>&, const typename glm::detail::tmat2x3<T>::col_type&) [with T = unsigned char]’ but no definition available
关于我在做什么的任何想法是错误的?
在此先感谢
当您明确实例化时,您是否有可用的body off操作符? – Anycorn 2010-10-04 01:14:29
你已经向我们展示了这个声明,但编译器正在抱怨这个定义。你如何定义模板? – Potatoswatter 2010-10-04 01:31:10