|
True. What he really needs is a multimap.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Does multimap let you search the values ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sorry, I meant a bi-directional map, not a multi-map.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I have used map and multimap , and read about but never used hash_map and hash_multimap . What exactly do you mean by a bi-directional map? I always thought bi-directional containers were containers that had both forward and reverse iterators, but that definition does not seem to be what is being discussed here. What I think you mean is a map where both the key and value are unique, and has a find() member that can find either the key or the value. Is there such a beast? If so what is it called and where can I get it?
Currently I am just using a map for this functionality, I check to make sure the value is unique before I add a new value to the map, and I sequentially iterate the map, comparing values, until I find the keyvalue I am looking for. If there is a better implementation out there I would be interested in learning about it.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
What I think you mean is a map where both the key and value are unique, and has a find() member that can find either the key or the value.
Yes, exactly.
PJ Arends wrote:
If so what is it called and where can I get it?
I don't know. I'm tempted to write one, but I doubt I'll come up with anything revolutionary (i.e. very efficient). A hashmap of pairs, with uniqueness enforced on values is what comes to mind.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks Ravi. I thought you were refering to an already existing implementation that I did not know about. I guess I have to stick to my home-brewed hack.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
An off-the-sheld bidirectional map is provided here[^]; unfortunately, it doesn't work with MSVC 7.1. For a more comprehensive solution, allow me to suggest you take a look at the Boost Multi-index Containers Library[^], which enables the construction of bidirectional maps and more.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Thanks Joaquín, your CP article looks interesting. I will DL the code and play with it to see if it fits my needs
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
a tought ...
if the strings are unique, make a map that points to ( a pointer to ) a structure containing a CWnd and a HTREEITEM
when you create the CWnd, attach the structure to the CWnd ( as a member of the class )
when you create the Tree Item, attach the structure to the Item ( CTreeCtrl::SetItemData )
when you click on the window, you can find exactly which item to highlight; and when you click on the tree item you have the pointer to the CWnd.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I want to build a background service application, which means when the user start the application, it will just show an icon in the task bar. And of course user can double click the icon to configure the service setting.
So the issue is how to put it into the task bar...
|
|
|
|
|
It's a testament to how great this site is that when I do a google in response to people who ask questions that have obviously been answered a million times online before, the first[^] hit refers back to the Code Project.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thanks so much,
sorry to repeat such an old question to bother...but anyway your link will make it easy for me to get to the right place~
^-^
|
|
|
|
|
It's no worry for me to answer you, it's more that to succeed as a developer, you need to do some research before asking questions
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
Sorry for this crosspost from WTL message board but I didn't get an answer there.
In my main frame I have a splitter pane with two views. I want to scroll the appropriate window when the mouse hovers over it. What is the best way to do this?
I was thinking of handling the WM_MOUSEWHEEL message and checking if the cursor is within the bounds of the view's rectangle (using GetCursorPos() and GetWindowRect()) but I think it might cause other problems.
I also tried using WM_MOUSEHOVER and WM_MOUSELEAVE but I am not sure how to best implement them.
Is there another way?
Thanks in advance.
|
|
|
|
|
What's the worry with GetCursorPos, etc ? That's how I'd expect to do it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Or watch for The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.
You would get the mouse coordinates and some other state informiton. You can use PtInRect to see which part of the frames the mouse is in to decide which area to scroll.
|
|
|
|
|
I have a project coded by Visual C++ languge, when I open it in Visual C++ .NET and I convert to .NET project.
What changes will my project change ?
Could I use my new project in Visual C++ 6.0 ?
Thank you
|
|
|
|
|
You can't use your new project in VC6, mainly because VC6 can't open the project file. Opening in VC.NET will simply create a project file in the new format. As you have an older project, you'll probably get build warnings about features in libraries like MFC that are deprecated, but they will still build and run, assuming your code was standards compliant.
Assuming you're not using managed C++, then the other differences are greater standards compliance, and a far better implimentation of the STL. A VC.NET project that doesn't use MFC, ATL or MC++ stands a better chance of compiling in a third party compiler than a VC6 project written under similar constraints.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Well i too had this problem once you have made the Project usint Visual C++ .net after that it was not properly working in Visual C++ 6.0.
And i need to rebuid it in Visual C++ 6.0.
if somebody can provide help on this it will great.
Regards
Anil
Anil Kumar
|
|
|
|
|
I'm hoping someone ran into this problem and knows a workaround.
Situation: to support proper uninstall I want my menu to be temporary (at each connect I recreate the menu). Appearently, items added to the main menu don't follow the normal rules and dont get removed when Word is closed. Another attempt... calling Delete on CommandBarControl when disconnecting fails for some reason.
Alex Korchemniy
|
|
|
|
|
well i have made a prog to capture ascreen but its not working in gui
pls help me
i have use getdesktop function
using hdc doenst work
pls help me out
|
|
|
|
|
You see that little search box at the top of this screen (directly under the CodeProject logo)? Go there and type "Screen Capture" and click the go button. You will then get a whole list of articles covering the topic.
Within you lies the power for good - Use it.
|
|
|
|
|
prashant66_2000 wrote:
i have use getdesktop function
Carefull of getdesktopwindow
If called from a modal dialog there is a chance the desktop becomes disabled, which disables all of its descendants. ie, it disables every window in the system.
suhredayan There is no spoon.
|
|
|
|
|
Hi There,
I am getting error "Memory could not be written" only in release mode and that too not on my machine.
I thought of using MAPinfo to get the line number/function call where application is crashing. Unfortunetly address shown in error message doesnt come close to addresses mentioned in my MAP file.
I am very very confused, not getting any way to find this crash.
My memory address in MAP file starts from "0x00400000" to "0x004002xxxx".
Error message shows " The instruction at "0x77fcaea0" referenced memory "some address", memory could not be written.
Can somebody please help me in this? I am completely bugged with this error.
I am not able to reproduce this error at my end.
thanx in advacne,
regards,
Kavita
|
|
|
|
|
I know it doesn't really help you, but the chances are you are giving a bad pointer to a function
in a DLL. (Ie. every single Win32 API function). What you need is the stack of functions, so you can
see the last function of yours to narrow things down.
I'm sure there is an article or two here which may be able to help, but thats outside my realm!
Iain.
|
|
|
|