Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
adding search capability to a Vector
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="SG, post: 3790684"] This struct isn't C compatible anyway so you might want to define it the C++ way: struct TBuddy { //... }; Why do you want to store pointers in the vector? Why public inheritance? Why making your own class? Since the member function is declared const, 'this' points to a const TBuddies object. The functions begin() and end() are "const overloaded". Their const versions return instances of const_iterator. Anyways, inside findValue you don't need access to any protected fields. You better make it a free function that calles std::find_if. Or better yet: use a std::map. It looks like std::map (instead of std::vector) is what you are looking for. Cheers! SG [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
adding search capability to a Vector
Top