I'm using a data structure of the type:
std::map<std::set<int>,std::set<char*>>, where as you notice that the key is
a set of ints and the value corresponding to it is a set of strings. However,
when I try to map a key to a set of strings such that the set contains more
than 20 strings, the mapped value is empty. For example if I do something
like this:

----------------------------------------------
std::map<std::set<int>,std::set<char*>> mapInt2Char;
std::set<int> setKey;
std::set<char*> setValues;
char *pChar = null;

setKey.insert(1);
for(i - 0;i < 25;i++)
{
pChar = new char[10];
sprintf(pChar,10,"%d",i);
setValues.insert(pChar);
}

mapInt2Char[setKey] = setValues;
-----------------------------
I find that the value corresponding to the key {1} in the map is empty. It
works fine as long as the number of strings in the set is less than or equal
to 20. I don't get this problem when the mapped value is a set of ints. Does
anybody know why this is happening? I'm using VS 2005.

RE: std::map problem by Smriti

Smriti
Tue Jan 08 16:50:03 CST 2008

The issue is resolved, please ignore the above post.

"Smriti" wrote:

> I'm using a data structure of the type:
> std::map<std::set<int>,std::set<char*>>, where as you notice that the key is
> a set of ints and the value corresponding to it is a set of strings. However,
> when I try to map a key to a set of strings such that the set contains more
> than 20 strings, the mapped value is empty. For example if I do something
> like this:
>
> ----------------------------------------------
> std::map<std::set<int>,std::set<char*>> mapInt2Char;
> std::set<int> setKey;
> std::set<char*> setValues;
> char *pChar = null;
>
> setKey.insert(1);
> for(i - 0;i < 25;i++)
> {
> pChar = new char[10];
> sprintf(pChar,10,"%d",i);
> setValues.insert(pChar);
> }
>
> mapInt2Char[setKey] = setValues;
> -----------------------------
> I find that the value corresponding to the key {1} in the map is empty. It
> works fine as long as the number of strings in the set is less than or equal
> to 20. I don't get this problem when the mapped value is a set of ints. Does
> anybody know why this is happening? I'm using VS 2005.

Re: std::map problem by Tim

Tim
Thu Jan 10 00:22:52 CST 2008

Smriti <Smriti@discussions.microsoft.com> wrote:
>
>The issue is resolved, please ignore the above post.

What was the resolution? Your answer will help the next guy that has a
similar problem and goes Googling for it.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: std::map problem by Ulrich

Ulrich
Thu Jan 10 02:40:53 CST 2008

Tim Roberts wrote:
> Smriti <Smriti@discussions.microsoft.com> wrote:
>>
>>The issue is resolved, please ignore the above post.
>
> What was the resolution? Your answer will help the next guy that has a
> similar problem and goes Googling for it.

Also, what was the problem? The code he showed sure did not compile for at
least two reasons, not including that it was just a snippet...

Uli