|
When you're choosing a container choose a vector. They're (except for one case) as fast as an equivalent automatic array. Then if you find the interface or performance characteristics of something else works better you can change it later.
|
|
|
|
|
Well... although a dynamically growing vector will still be slower than a pre-allocated array. Although you can presize a vector as well but that would require you to know about the speed cost of dynamic allocation and how vectors allocate arrays internally. Guess what I'm getting at is... you have to know at least a little about your containers and how you're using them.
In summary, no free ride. 
|
|
|
|
|
Could anyone please help me to find why call to sort() is crashing at run-time in following code block:
string s = "Annnitttesrrh.";
vector<char> vecChar(s.begin(), s.end());
sort(vecChar.begin(), vecChar.end(), greater_equal<char>());
Am i missing something very basic ?
|
|
|
|
|
|
I think that equality don't work in sort. Why swap elements if they are equal?
|
|
|
|
|
Windows 7, Visual Studio 2008, C++, Console app
when writing an application that uses std::string this code does not compile:
void C_Client_WinAPI_TCP::Get_Host_Name( std::string * host_name )
{
std::size_t source_length = host_name->length();
std::size_t copy_length = m_host_name.copy( *host_name, source_length, 0 );
Getting the length is find. When doing the copy the error is:
1>e:\b\bryan_code\tcp_ip_win_api_01\client\c_client_winapi_tcp.cpp(22) : error C2664: 'std::basic_string<_Elem,_Traits,_Ax>::copy' : cannot convert parameter 1 from 'std::string' to 'char *'
It seems to me that when using a std::string method, as in dot copy, it should copy from a std::string to another. Why not?
Edit: And given the above method declaration what is the right way to accomplish this concept:
m_C_Client_WinAPI_TCP.Get_Host_Name( "home" );
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/
modified 2-Oct-13 22:43pm.
|
|
|
|
|
The documentation[^] states that the destination parameter must be a pointer to a character array. Dereferencing a string does not return such a pointer.
In your second query, it would be better to declare the function as
void C_Client_WinAPI_TCP::Get_Host_Name(char* host_name);
That would allow you to pass a constant character string or a STL string to it.
Veni, vidi, abiit domum
|
|
|
|
|
When there is std::string declared in the prototype and in the caller, it seems to me I should be able to pass an argument of that type.
Follow up
std::string my_string;
char *p_char
p_char = *my_string;
This did not work for me. Understandable. What is the correct syntax for that concept?
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/
|
|
|
|
|
|
>How to create iwebbrowser2 in protected mode? i have requirement that i have to create IE in protected mode and invoke one url
|
|
|
|
|
|
Ya i saw those links and created medium integrity process but it didn't work. i heard about COM broker process
Any idea about this? i didn't get any example code for creating broker process for IE protected mode
|
|
|
|
|
narasingubhanu wrote: Any idea about this? Sorry, no.
Veni, vidi, abiit domum
|
|
|
|
|
hi!!!!
how to modify the size of window , I modify the parameter of CDialog::onCreate(),but it does not work
|
|
|
|
|
You need to provide much more information. Saying "it does not work" tells us very little.
Veni, vidi, abiit domum
|
|
|
|
|
Windows 7, Visual Studio 2008, C++, MFC
Question:
How do we put a control in a group box?
Details:
A group box is dragged placed in the dialog and a control dropped on it. (Static text, check box, and button) When the group box is moved, the control stays put. I interpret this as indicating that the control was not added to the group. I have looked closely at the properties for the group box and the control and have not recognized anything that will accomplish this. What needs to be done to put the control in the group box.
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/
|
|
|
|
|
Are you thinking of group box maybe in the Visio sense where you 'group' a set of visual objects and then they are treated as one ?
from what I recall, it never did that in MFC - you just referred to the elements of a group box in code slightly differently ? by an index
|
|
|
|
|
I don't know about Visio. After some searching it seems to me that I should be able to drop a control into a group box and have it become part of that group. When the group box is moved, the control moves with it group and stays in the same relative position. Is there some other meaning or use of the term "Group Box" and the control "Group Box."
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/
|
|
|
|
|
Sorry, worked late into Friday night on a deployment, family stuff yesterday, didnt get back to test this
Ive just tested in VS2005 C++/MFC
Created a new MFC, Dialog based app, edited the dialog - dropped and resized the 'Group Box' COntrol from the ToolBox, then dropped 3 x Radio Buttons into the Group Box.
Then I selected the Group Box, and it moved independently from the Radio Buttons. Only when I contol-Clicked the Group Box, AND each of the Radio Buttons, could I move them all together
bkelly13 wrote: Is there some other meaning or use of the term "Group Box" and the control
"Group Box."
Having a Group Box around the Radio Buttons changes how they are accessed - almost like an array - not 'moving them around the screen' - seems a bit odd, dont know if I took that much notice of all of this years ago when I did MFC
I know someone who actively uses MFC in VS2010 these days, I'll check with him
'g'
|
|
|
|
|
don't lose your time and don't spend lot of effort on an old programs builder , I advice you to use a new software coder like visual studio 2012 or Xamarin or RAD STUDIO XE4.
good luck in coding bro. 
|
|
|
|
|
VS 2008 is still a lot better than I am. Just the same, its five years old now. I found VS 2012 Pro via Amazon for about $350 and ordered it. I will see what that does. Does it make the group box work?
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/
|
|
|
|
|
If you are using the win32 dialog builder of VS (for dialog based MFC) then I have bad news. A groupbox is nothing more than simply a visual border with an optional label. It isn't supposed to be the parent of any controls, its not like a panel in modern usable rad gui development tools. You can use a groupbox to visually draw a "border" around a group of controls that are functionally coupled but that's it. Upgrading to VS2012 won't change that. (BTW, have you ever programmed gui using "bare metal" win32?) In my opinion VS2008 is very good but my current favorite is VS2010. They have improved a lot in VS2010 including intellisense and a lot of small bugs. At first touch I didn't really liked VS2012 for some reason...
EDIT: also read this: Group Boxes[^]
|
|
|
|
|
If you want to select a 'group' of controls so that you can move them together, select one of the controls, then ctrl+click several others. You will see them highlighted with the borders of all/each. If you select one by mistake, ctrl+click again. This 'group' handling disappears when you select (click) without either ctrl or shift inside the dialog resource.
If you want to 'group' several controls in the Visio sense, Visual Studio doesn't do that (as other posters have indicated).
Windows 8 is the resurrected version of Microsoft Bob. The only thing missing is the Fisher-Price logo.
- Harvey
|
|
|
|
|
Me either,Perhaps it doesn,t support that 
|
|
|
|
|
I am creating an SDI application.
On Start, its title is "Untitled - MyApp".
When i load a file named File1.txt using open button, then its title is changing to "File1.txt - MyApp".
The Problem arise when i want to change the title without loading a file using open button. Can anybody tell me how to set the title of an SDI application.
Thanks in advance!!!
|
|
|
|