Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. error C2451: conditional expression of type 'std::_Tree_iterator<_Mytree>' is illegal

error C2451: conditional expression of type 'std::_Tree_iterator<_Mytree>' is illegal

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kamal1977
    wrote on last edited by
    #1

    std::map <iCString,unsigned int> mCounters; //This function populate the "mCounters" map GetCounters(mCounters); map< iCString,unsigned int>::iterator it; for (map<iCString,unsigned int>::iterator it = mCounters.begin(); it = mCounters.end(); ++it) { } I am getting the error mentioned in the subject... what is the mistake I am doing :-( ? Fulll Error message ------------------ error C2451: conditional expression of type 'std::_Tree_iterator<_Mytree>' is illegal 1> with 1> [ 1> _Mytree=std::_Tree_val,std::allocator>,false>> 1> ] 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

    G 1 Reply Last reply
    0
    • K kamal1977

      std::map <iCString,unsigned int> mCounters; //This function populate the "mCounters" map GetCounters(mCounters); map< iCString,unsigned int>::iterator it; for (map<iCString,unsigned int>::iterator it = mCounters.begin(); it = mCounters.end(); ++it) { } I am getting the error mentioned in the subject... what is the mistake I am doing :-( ? Fulll Error message ------------------ error C2451: conditional expression of type 'std::_Tree_iterator<_Mytree>' is illegal 1> with 1> [ 1> _Mytree=std::_Tree_val,std::allocator>,false>> 1> ] 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

      G Offline
      G Offline
      Graham Breach
      wrote on last edited by
      #2

      You missed a symbol from the middle of your for loop expression.

      it = mCounters.end()

      should be

      it != mCounters.end()

      K 1 Reply Last reply
      0
      • G Graham Breach

        You missed a symbol from the middle of your for loop expression.

        it = mCounters.end()

        should be

        it != mCounters.end()

        K Offline
        K Offline
        kamal1977
        wrote on last edited by
        #3

        :) :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups