简体   繁体   English

没有函数头的C ++程序编译

[英]C++ program compiling without functional header

As per CPP Doc , std::greater is defined in <functional> header but my C++ program using std::greater is compiling with TDM-GCC-64 5.1.0 and running with only the following includes : 根据CPP Docstd::greater<functional>标头中定义,但我使用std::greater C ++程序正在使用TDM-GCC-64 5.1.0进行编译,并且只运行以下包括:

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>

It could be because <algorithm> automatically includes <functional> but since this is not mentioned in the doc, I was wondering is there a way to know this before hand ? 这可能是因为<algorithm>自动包含<functional>但是因为文档中没有提到,我想知道有没有办法知道这个呢?

只是为了结束该主题,结论是这是依赖于实现的,并且应该包括所有必要的头部以便于移植。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM