[Dev-C++] 'extern const' and std::vector
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: David M. <ci...@ya...> - 2003-05-01 13:10:10
|
My first question concerns the extern keyword. If I have a varible in one file (it is not a constant) but that varible needs to accessed from the functions in another file. However these other functions do not need (actually I don't want them to have) write access to this variable, can I do something similar to 'const <var_type> <var_name>?'. For those of you who are wondering why I don;t just try it myself I would like to know what EVERY ANSI compatible compiler will do. The program I am writing must remain portable. My other question concerns the std::vector container class of the STD. As far as I have seen the std:vector class stores it's contents contiguously in memory (just like an array). Does this make vector classes reach their maximum size once there is no block of memory big enough to hold it's data? I plan to use this class to act as the index for world system with up to 2^32 rooms in it (even if I store only pointers to each structure it still gets pretty big). Would any of the other containers be better suited to this purpose? I chose the vector bacause of it's speed (4 billion possible rooms, gonna need the speed). The requirements for the container is to allow for a numbering system for eah of the rooms with rooms being grouped within ranges. --------------------------------- Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. |