jeudi 23 février 2017

dereferencing string iterator in make_pair call [duplicate]

This question already has an answer here:

I have the following code:

    std::string s("abcdef");
    std::string::iterator first = s.begin();

    char c1 = *first; // this works

    std::make_pair<char, int>(*first, 1); // this doesn't work 

So when I dereference the string iterator to a standard char, it works fine. However when I use it directly in a std::make_pair call, it doesn't seem to work. What is the reason for this?

Thank you.

Aucun commentaire:

Enregistrer un commentaire