|
Hi,
I have a STL question about multimap.
I have a multimap say like..with duplicate keys.
multimap <int, someobject=""> someMap;
..
After inserting some values...I do something like..
multimap <int ,="" someobject=""> ::const_iterator iter;
iter = actionList.find(someObj); // this is the duplicate key and has multiple entries
Now, I want to iterate through all the values that have this key. How can I do that? Any help would be greatly appreciated. Do I have to call find() multiple times till iter points to the end of the map??
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
equal_range gives you two iterators ranging all duplicate values.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You can see an example here:
http://www.roguewave.com/support/docs/sourcepro/stdlibref/multimap.html
the bit you're interested in is this:
std::pair<months_type::iterator, months_type::iterator=""> p
= months.equal_range (30);
// Print out the 30 day months.
std::cout << "\nMonths with 30 days\n";
for ( ; p.first != p.second; ++p.first)
std::cout << (*p.first).second << '\n';
|
|
|
|
|
Hi, so far i newer have coded using DirectX i've found some tutorials to draw bitmaps on screen. Is there no function to draw colored 2d pixels? or some way like we did in dos you know poke(0xA000,(y*320)+x,clr)
So i just want to draw 2d graphics with DirectX.
|
|
|
|
|
It's possible to draw single pixels in DirectDraw or Direct3D, but the methods are a bit cumbersome and are generally pretty inefficient. Modern graphics hardware exploits parallelism between the GPU and the CPU, and sending commands to draw pixels one by one carries a lot of overhead.
That said, here is an article on drawing single pixels in DirectDraw:
http://www.gamedev.net/reference/articles/article538.asp[^]
- Mike
|
|
|
|
|
Thanks for this link.
You're right it seems to be time waste to do that,
i think i better use bitmaps to realize my ideas
|
|
|
|
|
I've noticed that the VS 6.0 Debug window will only
display so many lines before giving up and/or reaching
some maximum number of lines of Debugging output.
Have been working on a large project and am getting sick
of trying to shift around all the TRACE calls so that I
can see all that I need to.
I am assuming that this is either a deficiency of the IDE
or that somewhere there is a limit as to how many lines
the Debug window will display - if this is the case, where
do I increase that? If not, is there a fix available??
Is it possible to redirect output from this window, to, say
a log file??
TIA.
John Theal
Physicist/Mathematical Programmer
Digital Immersion Software Corporation
Got CAD?
http://www.presenter3d.com[^]
http://www.merlin3d.com[^]
|
|
|
|
|
Goto www.dilascia.com and look at his TraceWin project. It is a good alternative to dumping to the debug window and supports logfiles.
|
|
|
|
|
|
Hi,
I have a Dialogbar created from the OnCreate method of the CMainFrame class. I have a static control and a button on that Dialogbar. I'm able to catch the button click event (using the mainframe menu) but I can't get the click event from the static control.
Can anybody help me out with this problem ??
Thanks
Jean Bédard
|
|
|
|
|
|
(I know this isn't really VC++)(Or is it?)(Anyway, it's not MFC)
Example:
void main(){<br />
int nInt;<br />
int *pInt;<br />
cout << <br />
}
I want to output the memory location of nInt. This location is saved into pInt .
The memory location is for instance 3031:3233, so pInt contains 0x30313233. If I would convert this (how) to char*, it'd say "0123". But what I want is 0x30313233 to be converted to a string saying "0x30313233". How is that possible?
I know it is weird, but this is what I tried:
void main(){<br />
int nInt;<br />
int *pInt;<br />
cout << char*(void*(pInt));<br />
}
//Excuse me for my bad English.
//---QUOTE---
//
//"ERROR: Keyboard not present - Press F1 to continue" - Most BOIS chips
|
|
|
|
|
Maybe this works? (haven't tried it out yet)
cout << "hex = 0x" << hex << (void*) pInt;
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
take a look at the function sprintf. it has the features that you are looking for and is part of the c runtime.
|
|
|
|
|
int nInt = 54321;
int *pInt = &nInt;
char buf [11];
sprintf (buf, "0x%08x", (unsigned int)(pInt));
cout << buf;
I must be in a good mood. Normally I'm not this helpful!
Iain.
|
|
|
|
|
DaFrawg wrote:
I want to output the memory location of nInt.
This printed out the address for me:
int nNumber,
*pAddr;
pAddr = &nNumber;
cout << pAddr << endl;
If you want that address in a char* variable, use:
char addr[32];
sprintf(addr, "%#x", pAddr);
cout << addr << endl;
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
How about this:
#include <iostream>
void main()
{
int iVar;
void *pVar = &iVar;
std::cout << pVar << std::endl;
}
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
I found that some controls in CDialog are always not need,
so it is better to hide them,
They are in a some GroupBox.
and let for user to do it..
I did nor found such a article.
http://www.codeproject.com/miscctrl...target=groupbox
- no hiding
Is there such a control?
May be stack CDialog is useful for it?
- hiding groupbox?
(Big reconstruction is need?)
thanks you.
|
|
|
|
|
Try here[^]
And change it to alter the inner windows, rather than disable them.
Also look in the www.codeproject.com/dialog(s?) section as well as www.codeproject.com/miscctrl.
Or you could even write the code!!!!! [*]
Iain.
[*] if you do, think about turning it into an article.
|
|
|
|
|
I Need hide content ability.
|
|
|
|
|
Hi,
does somebody know a function which retrieves the HWND handle of the titlebar ?
Thanks in advance!
|
|
|
|
|
|
There isn't a direct command to do this. The title bar is part of the non-client area of a regular window which has a caption. If you need a custom caption or something similar, do a quick search for the author "lorde" on CP, David Lorde (do his second name only), as he has published a really good article on custom captions.
Sorry, don;t have time to look the link up myself.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
I'm happily using ShellExecute to open DOC files and URLs.
I can append "#bookmark" to a URL for IE to open at the specific section of a page, but if I try the same with DOC files then it doesn't work - I don't even get the DOC file open.
Am I expecting too much of ShellExecute?
Is there some other technique for opening such files?
Many thanks
|
|
|
|
|
Hi again....
People...
Is there a way to convert my vcpp project
from "win32 app" to "ocx or somthing"...
so I can use it as a control... in other projects ???
=-=-=-=-=
The Server
|
|
|
|