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
M

mcoloney

@mcoloney
About
Posts
7
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • so...
    M mcoloney

    :omg:What he said.

    The Lounge com question

  • Passing a vector of pointers
    M mcoloney

    Dave, Thank you again. You're a master.

    C / C++ / MFC graphics help

  • Passing a vector of pointers
    M mcoloney

    Dave, thanks again for your quick and informative reply. Allow me to include better code representation: My function definition is: void addPhoneRecord(string& name, string& address, string& phone, PhoneRecord* records[]) { Name* nameEntry = new Name(); nameEntry->set_name(name); Address* addressEntry = new Address(); addressEntry->set_address(address); PhoneRecord* phoneEntry = new PhoneRecord(nameEntry, addressEntry); phoneEntry->set_phoneNumber(phone); records.push_back(phoneEntry); } When I call it from main I'm using: addPhoneRecord(name, address, phone, &phonerecs.back()); All of the setting functions and the like work like they should, and properly. The error I'm getting is: error C2228: left of '.push_back' must have class/struct/union type If I comment out the records.push_back(phoneEntry); it compiles fine, but I get the standard WinXP error report problem. Any suggestions? Thanks again.

    C / C++ / MFC graphics help

  • Passing a vector of pointers
    M mcoloney

    Friends, I have a vector of pointers: vector< PhoneRecord*> phonerecs(MAX); I want to pass this vector to a function so I can add things to it outside of main(). The function declartion is: void addPhoneRecord(PhoneRecord* records[]); and call it from main() using something like: addPhoneRecord(phonerecs); The error I'm getting is: error C2664: 'addPhoneRecord' : cannot convert parameter 1 from 'class std::vector<class PhoneRecord *,class std::allocator<class PhoneRecord *> >' to 'class PhoneRecord *[]' I understand I'm not passing this correctly... I'm sure this is a somewhat easy solution, but I can't seem to pinpoint it. Thanks in advance!

    C / C++ / MFC graphics help

  • operator != for iterators
    M mcoloney

    Dave, thank you so much for your help!

    C / C++ / MFC help c++ tutorial question

  • operator != for iterators
    M mcoloney

    Sorry about that. It's reposted. Ignore the space after the < and before PhoneRecord.. it was making it a smiley.

    C / C++ / MFC help c++ tutorial question

  • operator != for iterators
    M mcoloney

    Friends, I'm trying to create a function so I can print the conents of a STL list from main(). It looks like: void TraverseAndDisplay(list< PhoneRecord>::iterator& itor, const list< PhoneRecord>& l) { while (itor != l.end()) { cout << *itor++ << " "; } cout << endl; } Unfortunately, because PhoneRecord is not a primitive data type (it's my own class), the default operator != won't work. The exact error I'm getting is: error C2679: binary '!=' : no operator defined which takes a right-hand operand of type 'class std::list<class PhoneRecord,class std::allocator<class PhoneRecord> >::const_iterator' (or there is no acceptable conversion) Obviously I need to overload the != to work. I don't know how to overload the != operator to work for iterators in this case? Thanks in advance for your help!

    C / C++ / MFC help c++ tutorial question
  • Login

  • Don't have an account? Register

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