vscode上已经引入了<bits/stdc++.h>,如果不加#include<unordered_set>就会报红

vscode上我写了一段代码,但为啥我已经引入了<bits/stdc++.h>,如果不加#include就会报红,但明明不加也可以编译运行

#include <bits/stdc++.h>
#include<unordered_set>
using namespace std; 
using pi = pair<int,int>;

bool operator==(const pi& a, const pi& b) {
    return a.first == b.first && a.second == b.second;
}
struct myhash
{
    std::size_t operator()(pi const& a) const 
    {
        return a.first ^ a.second;
    }
};
int main(){
    unordered_set<pi,myhash>s;
    s.insert({1,2});
    int a;
    return 0;
}

img

如图,非要加这个头文件才不红,但加不加都能运行

img

因为红是vscode根据你给的库目录,在里面检索你程序包含的库文件,然后在这个库文件搜索这个unordermap,bits/stdc++.h 里面并没有包含这个声明,实际上这个文件里面是include很多其他库文件, 可能vscode 没有递归检索的功能,但是编译器是可以识别这个库文件,并编译成功的