I was just thinking about this today when I had to enter in a lot of directives when working on a couple programs.
Would it possible to combine them all into one directive. So you would uses #include <alldirectives> and that would included all the directives?
Kinda weird to explain but would something like that be possible?
#include <> question directives
Page 1 of 15 Replies - 1050 Views - Last Post: 20 December 2007 - 09:35 AM
Replies To: #include <> question directives
#2
Re: #include <> question directives
Posted 18 December 2007 - 09:20 AM
If you were to write your own compiler to do it, sure.
#3
Re: #include <> question directives
Posted 18 December 2007 - 09:23 AM
Um I think im going to pass on that then
.
#4
Re: #include <> question directives
Posted 18 December 2007 - 11:54 AM
Maybe write your own header file? I don't recommend doing this (its poor practice), especially not if you like adding using declarations in your programs - you'll end up polluting the global namespace pretty heavily, but its the closest that standard C++ has to an #include <all> for the moment. Though I believe a standard <all> header is, or was at one point, being seriously considered for C++0x by the C++ standards committee.
#ifndef ALL_H #define ALL_H #include <istream> #include <ostream> #include <iostream> #include <fstream> #include <string> #include <algorithm> #include <functional> #include <vector> #include <map> #include <list> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <limits> #include <memory> #include <sstream> #include <cstdio> #include <ctime> #include <cmath> #include <cstdlib> #include <cstring> #include <cctype> #include <cassert> /* TODO: Insert headers as needed */ #endif
This post has been edited by Bench: 18 December 2007 - 12:02 PM
#5
Re: #include <> question directives
Posted 18 December 2007 - 01:38 PM
It would mainly be for the ones I am currently using (iostream, fstream, string)
#6
Re: #include <> question directives
Posted 20 December 2007 - 09:35 AM
As bench pointed out, of you create a header file that includes all the other headers you need then you can just include that header in your source, and the compiler will cascade to all the rest. Some people swear by doing it this way -- keeping all the header information together. I personally like to keep the include near where I use its contents, that way I use my IDE to quickly open up the header file.
You know when I was new to C/C++ I thought reading the standard header files would make me a great programmer, then I came to the realization that they were just too complex. Later I started going back into them and they were no longer so complex -- now I often wade though them.
You know when I was new to C/C++ I thought reading the standard header files would make me a great programmer, then I came to the realization that they were just too complex. Later I started going back into them and they were no longer so complex -- now I often wade though them.
Page 1 of 1

New Topic/Question
Reply



MultiQuote




|