|
George_George wrote: and my further question is why should we use pair? In what situations should it have more benefits?
It's a long story, and this[^] is one such story.
BTW IMO googling on these questions will help you more, instead of waiting 3 hours for someone to answer your queries.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Thanks Nibu,
I have taken one hour to do reading for the great document you referred. But from the document, there is no conclusion what is the special benefits of using pair. Do you have any ideas or comments?
regards,
George
|
|
|
|
|
George_George wrote: I have taken one hour to do reading for the great document you referred
George_George wrote: Do you have any ideas or comments?
Some stl containers do take/return a pair object, that's one of the reason why I would use a pair.
George_George wrote: But from the document, there is no conclusion what is the special benefits of using pair.
Exactly that's why I said it's a long story.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi Nibu,
Nibu babu thomas wrote: Some stl containers do take/return a pair object, that's one of the reason why I would use a pair.
It means we have to use it...
Any way, could you list your reaons (besides the above one) why and when using pair has special benefits please?
regards,
George
|
|
|
|
|
George_George wrote: It means we have to use it... Smile
Yeah sometimes!
George_George wrote: Any way, could you list your reaons (besides the above one) why and when using pair has special benefits please?
From MSDN:
The two most common uses for a pair are as return types for functions that return two values and as elements for the associative container classes map Class and multimap Class that have both a key and a value type associated with each element. The latter satisfies the requirements for a pair associative container and has a value type of the form pair<const mapped_type="">.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Thanks for finding that, but the latter makes additional one copy, correct?
regards,
George
|
|
|
|
|
Hi all,
I am working on RPC client programing(VC6.0).
As I got info from CP that MIDL to be used for client and server stubs.
I have designed an RPC server test application and My client and server
able to communicate succesfully with the stubs generated by MIDL.
But If I have an Linux server or any third party windows server, then how to design my client?
How can I get the client stub.
Regards,
Sunil Kumar
|
|
|
|
|
there are basically two RPC 'derivatives'/Implementations for a better word
Microsoft
ONC/Sun
unfortunately, Microsoft isnt compatable with ONC/Sun (and v-v) .. so, if you're on a windows box for example, and you want to RPC to a *nix box, you need a win32 port of ONC RPC - luckily, someone else has thought of this and (last time I checked) there were two versions out there.
it really depends on the implementation/version of RPC the 'other end' is using
thats a very brief sketch only, you'll need to research more than that
'g'
|
|
|
|
|
Thanka a lot for your info.
Regards,
Sunil Kumar
|
|
|
|
|
Hi guyz,
I just want to know if there's a limit on vector size.
What is the maximum vector size?
I'm using a vector of CString and store about 100K+ absolute path
and experience program hang. Am I reaching the vector's limit?
Hope you can help me thanks.
|
|
|
|
|
TooShy2Talk wrote: I just want to know if there's a limit on vector size.
Use max_size member function of std::vector.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi,
Does anyone use these classes, or the new Ribbon control in the MFC update?
Has anyone considered inheriting from them?
I'm looking to insert a DateTime picker control into a ribbon, and thinking of inheriting from CMFCRibbonBase element. I've had a look around, and cant find anyone else inheriting from these. Surely someone has tried it?!?!
thanks,
Mark.
|
|
|
|
|
Hi All,
Can Anyone guide me on how to pass float or double argument in _beginthread() function in argument list (3rd) argument?
I need to complete my assinment asap so it would be great if anyone can help me out.
Thanks.
|
|
|
|
|
you can just pass the address to the call of _beginthread and do a cast to a (double *) in the thread function.
|
|
|
|
|
You can pass a pointer as Rick suggested. I'll add this...
make sure the object pointed to stays in scope
double mydouble = 4.2;
_beginthread(&mythreadproc, 0, &mydouble); <code><-- BAD!!! mydouble may go out of scope before spawned thread uses it!</code>
return;
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I used this MDI Article[^] or MSDN MDI Article[^] but it still gives me errors, I've searched for about a week with thousands of different combination's to get the information i am looking for, can someone teach me or show me an article on how to create MDIParents and Child's and open the child windows when clicking on a button or a menu.
Error 1 error C3699: '*' : cannot use this indirection on type 'MDITest1::Form2' c:\documents and settings\nicholas king\my documents\visual studio 2008\projects\mdi test1\mdi test1\Form1.h 164<br />
<br />
<br />
Error 2 error C2039: 'MDIParent' : is not a member of 'MDITest1::Form2' c:\documents and settings\nicholas king\my documents\visual studio 2008\projects\mdi test1\mdi test1\Form1.h 167<br />
modified on Tuesday, August 26, 2008 4:50 PM
|
|
|
|
|
Looks like that code was written for Managed Extensions for C++
(Visual Studio 2002/2003 .NET).
There is a compiler option to support the old syntax but upgrading
the code to the new syntax is the best long-term option IMO.
Just to make sure - is a .NET forms app really what you want or do you
want a native MDI app? If .NET forms is what you're after, you're posting
on the wrong board.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Alright, well I am using 2008 and I can't find anything on the new syntax even on MSDN.
Sorry about posting on the wrong board, I usually posted my questions here.
I want native, but doesn't matter to me.
|
|
|
|
|
|
Thanks Mark, I'll take a look at those after I get back tomorrow.
|
|
|
|
|
Hi everyone.
I'm having some problems removing objects from a list.
Here's the code.
cout<<"Name of the band you want to delete: ";
fflush(stdin); getline(cin,nameband);
band = myManager.select_band_name(nameband);
if(band!=0)
{
(...)
myManager.remove_band(*band);
(...)
The remove function is this:
void Manager::remove_band(const Band & bd)
{
available_bands_list.remove(bd);
}
There are no debug or run-time erros... did I miss something?
Thank you.
|
|
|
|
|
Is the "band" you're trying to remove really in the list?
I mean, it looks like you store Band references in the list and the reference you're trying to remove may refer to another object which is not in the list.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
|
yes.. it worked. I mean, there where no building errors or run-time errors after I made the changes you told me to. The thing is I run the remove function but the object remains there.
|
|
|
|
|
FrankMookie wrote: The thing is I run the remove function but the object remains there.
Have you tried the example code[^] and seen that it works?
Once you see that works correctly, you should then suspect your operator implementation is faulty. You can verify this by debugging.
Cedric Moonen wrote: So you need to provide an operator which receives a Band:
led mike
|
|
|
|