| | |
How to use VERY Long STL Vectors?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
>>if you can have it in memory, then you can have it in a vector.
No it doesn't. If he is still using 32-bit compiler than the size of the long int is not changed from what it is on a 32-bit operating system, and the STL libraries will still be 32-bit libraries. He will need to use a 64-bit compiler to make any use of the 64-bit os.
No it doesn't. If he is still using 32-bit compiler than the size of the long int is not changed from what it is on a 32-bit operating system, and the STL libraries will still be 32-bit libraries. He will need to use a 64-bit compiler to make any use of the 64-bit os.
Last edited by Ancient Dragon; Mar 13th, 2009 at 2:31 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Aug 2008
Posts: 149
Reputation:
Solved Threads: 8
•
•
•
•
>>if you can have it in memory, then you can have it in a vector.
No it doesn't. If he is still using 32-bit compiler than the size of the long int is not changed from what it is on a 32-bit operating system, and the STL libraries will still be 32-bit libraries. He will need to use a 64-bit compiler to make any use of the 64-bit os.
so I found it safe to assume he is using a 64bit toolchain.
But your argument is valid. But for sake of completeness, the same can be said about a 16 bit compiler
•
•
Join Date: Mar 2009
Posts: 5
Reputation:
Solved Threads: 0
If I use a 64-bit compiler than a [icode]long int[\icode] is always 8 bytes? Then this basically solves my problem. I didn't know this was always true. Sometimes I see 4 bytes long ints, then maybe they have been compiled with a 32-bits compiler.
So I will just use long ints for my indices, and this will make it possible to address all the memory I have. I will also use multiple vectors for speed. It takes a long time to resize the vectors once they are big.
Thanks for all you replies.
One more question: If v is vector, what is the type of v.size()? Is it an long int?
Thanks.
So I will just use long ints for my indices, and this will make it possible to address all the memory I have. I will also use multiple vectors for speed. It takes a long time to resize the vectors once they are big.
Thanks for all you replies.
One more question: If v is vector, what is the type of v.size()? Is it an long int?
Thanks.
It's so simple (no need in DaniWeb
), ask your compiler:
), ask your compiler: c++ Syntax (Toggle Plain Text)
typedef std::vector<double> DblVector; typedef std::vector<int> IntVector; DblVector dv; IntVector iv; cout << sizeof(DblVector::size_type) << '\n'; cout << dv.max_size() << '\n'; cout << iv.max_size() << endl;
•
•
Join Date: Nov 2008
Posts: 392
Reputation:
Solved Threads: 72
If you are using that much memory, you will be much better off using the boost array/multi_array classes. Then you will be better off using Blitz.
Word of warning: write the code using boost/stl untill it works with smaller data sets. THEN use Blitz. Otherwize the error messages and other problems are incomprehensible.
Word of warning: write the code using boost/stl untill it works with smaller data sets. THEN use Blitz. Otherwize the error messages and other problems are incomprehensible.
experience is the most expensive way to learn anything
![]() |
Similar Threads
- Self Teaching C++ (C++)
- Question on vector(STL's) (C++)
- question about vector .. please help (C++)
- Phonebook program! (C)
Other Threads in the C++ Forum
- Previous Thread: Need help with pennies for pay!!!
- Next Thread: Problem with converting char to int
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






