473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problem with deque and string

I don't know if this is not allowed or there is a bug in g++. If I have the
following definition:

typedef std::deque<const std::string> string_deque;

the compiler complains (in summary) that it cannot overload the allocator.
If I remove "const" thus:

typedef std::deque<std::string> string_deque;

the compilation is successful.

It is me or is it a bug?

Thanks.
Jul 22 '05 #1
2 1750
"Rich Herrick" <ri************@richherrick.com.delete.me.too> wrote in
message news:SY******************@twister.nyroc.rr.com...
I don't know if this is not allowed or there is a bug in g++. If I have
the
following definition:

typedef std::deque<const std::string> string_deque;

the compiler complains (in summary) that it cannot overload the allocator.
If I remove "const" thus:

typedef std::deque<std::string> string_deque;

the compilation is successful.

It is me or is it a bug?


It's you.

Standard container elements must allow assignment; const values don't.
Ergo, standard container elements can't be const.
Jul 22 '05 #2

"Andrew Koenig" <ar*@acm.org> wrote in message
news:Jg*********************@bgtnsc04-news.ops.worldnet.att.net...
"Rich Herrick" <ri************@richherrick.com.delete.me.too> wrote in
message news:SY******************@twister.nyroc.rr.com...
It's you.

Standard container elements must allow assignment; const values don't.
Ergo, standard container elements can't be const.

Thanks a bunch. You learn something new everyday!

Rich

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: newsock | last post by:
What differences between queue, deque and priority_queue? And under what situations choose one of them to use? Thanks for your help!
2
by: Frederik Himpe | last post by:
I'm implementing a SAX handler with libxml++. I have this piece of code: void PalamedeParser::on_start_element(const std::string &name, const AttributeList &attributes) { AttributeList::iterator...
7
by: Jenny | last post by:
Hi, I have a class foo which will construct some objects in my code. some of the objects store int values into the data deque, while others store float values to the deque. template <class...
19
by: chris | last post by:
Hello, I've recently been trying to understand the various structures supplied by c++, and the one I find most confusing is deque. One quick question about this. It seems most implementations...
2
by: Sk8Kid | last post by:
Hi, I have an fairly large std::deque<std::string> object, with about 100,000 or so strings in it. Calling object.clear() freezes my application for several seconds, which is undesirable. What is...
9
by: toton | last post by:
Hi, I am looking for a circular buffer solution ( a fixed buffer) , where the elements can be pushed back & removed front. It looks stl deque can be a solution. my question is, 1) circular...
0
by: toton | last post by:
Hi, I have a complex design of some dynamic situation. First I am posting the design, then a few questions regarding the problem I am facing. Hope some of the experts will answer the questions....
15
by: Juha Nieminen | last post by:
I'm sure this is not a new idea, but I have never heard about it before. I'm wondering if this could work: Assume that you have a common base class and a bunch of classes derived from it, and...
4
by: arnaudk | last post by:
I am trying to come up with a class design to deal with asynchronous data to be stored and analyzed over multiple time frames and could really use some design input. This is a rather long question...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.