insert in std::map does not insert the object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • simon.elbaz@free.fr

    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_bac k("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=f alse) : stKeyName(a_stK eyName), iPosition(a_iPo sition),
    bFilled(false), b_is_unique(a_b _is_unique)
    {}

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

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

  • simon.elbaz@free.fr

    #2
    Re: insert in std::map does not insert the object

    My question is no more valid: I was looking at the wrong part of code.
    Sorry

    On Nov 4, 11:48 pm, simon.el...@fre e.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_bac k("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=f alse) : stKeyName(a_stK eyName), iPosition(a_iPo sition),
    bFilled(false), b_is_unique(a_b _is_unique)
    {}
    >
    Key(const Key &a_key);
    Key &operator=(cons t Key &a_key);
    void clear();
    >
    };
    >
    and KeyCmp class:
    class KeyCmp {
    public:
    bool operator()(Key const &, Key const &) const;
    >
    };

    Comment

    Working...