469,267 Members | 979 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

insert in std::map does not insert the object

Hi,
i use the following map:

std::map<Key, std::vector< std::string >, KeyCmp mSQLElem;

The following code does not insert the newly created pair:
std::vector<std::stringvcTemp;
vcTemp.push_back("test string");
mSQLBody.insert(std::make_pair(Key(stKey, mSQLBody.size(),
b_is_key_unique), std::vector< std::string >(vcTemp)));

Thanks for your help!
Simon

////////////////////////////////////////////

The Key class is:
class Key {
public:
std::string stKeyName;
bool bFilled;
bool b_is_unique; // should this node be unique in the pattern
int iPosition;

Key(std::string a_stKeyName, int a_iPosition=-1, bool
a_b_is_unique=false) : stKeyName(a_stKeyName), iPosition(a_iPosition),
bFilled(false), b_is_unique(a_b_is_unique)
{}

Key(const Key &a_key);
Key &operator=(const Key &a_key);
void clear();
};

and KeyCmp class:
class KeyCmp {
public:
bool operator()(Key const &, Key const &) const;
};

Nov 4 '07 #1
1 1380
My question is no more valid: I was looking at the wrong part of code.
Sorry

On Nov 4, 11:48 pm, simon.el...@free.fr wrote:
Hi,
i use the following map:

std::map<Key, std::vector< std::string >, KeyCmp mSQLElem;

The following code does not insert the newly created pair:
std::vector<std::stringvcTemp;
vcTemp.push_back("test string");
mSQLBody.insert(std::make_pair(Key(stKey, mSQLBody.size(),
b_is_key_unique), std::vector< std::string >(vcTemp)));

Thanks for your help!
Simon

////////////////////////////////////////////

The Key class is:
class Key {
public:
std::string stKeyName;
bool bFilled;
bool b_is_unique; // should this node be unique in the pattern
int iPosition;

Key(std::string a_stKeyName, int a_iPosition=-1, bool
a_b_is_unique=false) : stKeyName(a_stKeyName), iPosition(a_iPosition),
bFilled(false), b_is_unique(a_b_is_unique)
{}

Key(const Key &a_key);
Key &operator=(const Key &a_key);
void clear();

};

and KeyCmp class:
class KeyCmp {
public:
bool operator()(Key const &, Key const &) const;

};

Nov 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Christopher | last post: by
1 post views Thread by Antti Granqvist | last post: by
5 posts views Thread by cppaddict | last post: by
14 posts views Thread by Flzw | last post: by
1 post views Thread by Saeed Amrollahi | last post: by
13 posts views Thread by kamaraj80 | last post: by
21 posts views Thread by aaragon | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.