我想为两个模板重载转换运算符。模板转换运算符
A.H
#pragma once
#include <B.h>
template <typename T> class A
{
operator B<T>() const;
}
B.h
#pragma once
#include <A.h>
template <typename T> class B
{
operator A<T>() const;
}
我有错误
error C2833: 'operator A' is not a recognized operator or type see
reference to class template instantiation 'B<T>' being compiled
虽然它的工作原理,如果转换操作符是一个模板,仅过载。
你使用什么编译器? – 2013-03-04 18:15:56
也许[这](http://stackoverflow.com/questions/14909997/why-arent-my-include-guards-preventing-recursive-inclusion-and-multiple-symbol)可以帮助('#pragma once'基本上工作作为包括后卫) – 2013-03-04 18:21:15