在C ++中转发typedef的声明 [英] Forward declaration of a typedef in C++
本文介绍了在C ++中转发typedef的声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么编译器不允许我声明一个typedef?
Why won't the compiler let me forward declare a typedef?
假设不可能,保持我的包含树很小的最佳做法是什么?
Assuming it's impossible, what's the best practice for keeping my inclusion tree small?
推荐答案
你可以转发typedef。但要做
You can do forward typedef. But to do
typedef A B;
您必须先转发declare A
:
you must first forward declare A
:
class A;
typedef A B;
这篇关于在C ++中转发typedef的声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文