什么是< iosfwd>标题? [英] What is the <iosfwd> header?
本文介绍了什么是< iosfwd>标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< iosfwd>
标头用于(在此文件)?
为什么有必要?
推荐答案
这样你可以在自己的头文件中声明依赖于iostream类型声明的方法,而不必<
It's so you can declare, in your own headers, methods that rely on the declarations of iostream types without having to #include
the iostream headers themselves, which are large, complex and slow to compile against.
这里有一个简单的例子:
Here's a simple example:
// foo.h
#include <iosfwd>
void sucker(std::iostream& is);
// foo.cc
#include <iostream>
void sucker(std::iostream& is) {
is >> somevar;
}
这篇关于什么是< iosfwd>标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文