Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include all of the C++ Standard Library at once?

I am working on a class project using vectors and linked lists. But in C++ in order to apply them I need to have the following code in my header.

#include<list>
#include<vector>

I know that both of these are a part of the standard template library. So I'd like to do a single

#include<StandardTemplateLibrary>

to save lines. But everywhere I look I don't see a singular command to add to my code and I've tried cstdlib, stdlib, cstdlib.h and none of them contain the keywords I need.

Is there a singular preprocessor that I can add to my project to do both of these? Or do I just have to include both? If you can refer me to source to read as well that'd be greatly appreciated.

like image 372
Callat Avatar asked Apr 21 '16 06:04

Callat


1 Answers

On some compilers, including <bits/stdc++.h> might do what you're looking for.

Note however that it makes your code nonportable (it may not work on other compilers, or even different versions of the same compiler). This is ok in some cases.

More info about why doing this might not be a good idea: Why should I not #include <bits/stdc++.h>?

like image 56
emlai Avatar answered Sep 29 '22 19:09

emlai