Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many character can a STL string class can hold?

Tags:

c++

string

stl

I need to work with a series of characters. The number of characters can be upto 1011. In a usual array, it's not possible. What should I use? I wanted to use gets() function to hold the string. But, is this possible for STL containers? If not, then what's the way?

Example: input: AMIRAHID output: A.M.I.R.A.H.I.D

How to make this possible if the number of characters lessened to 10^10 in 32-bit machine ?

Thank you in advance.

like image 404
Rahi Avatar asked Dec 03 '10 13:12

Rahi


1 Answers

Well, that's roughly 100GByte of data. No usual string class will be able to hold more than fits into your main memory. You might want to look at STXXL, which is an implementation of STL allowing to store part of the data on disk.

like image 172
hkaiser Avatar answered Sep 25 '22 17:09

hkaiser