|
IMHO:
George_George wrote: sort ( vector<int> )&
The above doesn't make sense.
In both cases, the developer is providing explicitely the template type.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Sorry CPallini,
I have not made myself fully understood. My question is (after reorganization),
1. for template function, we can choose to use either implicit mode to let compiler deduce or explicit mode to assign type;
2. for template class, we have to use explicit mode to assign type?
regards,
George
|
|
|
|
|
A curiosity:
George_George wrote: Sorry CPallini,
I have not made myself fully understood
Do you apologize and at same time vote me down?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Yeah, that's what he call:
Any comments or experiences or even disagreement is welcome.
"You are welcome, I will just vote you down if I didn't express myself correctly and if you didn't guess what I had in mind."
|
|
|
|
|
|
A bug of my mouse, CPallini!
regards,
George
|
|
|
|
|
Sorry, CPallini!
I made a wrong click.
regards,
George
|
|
|
|
|
I suppose that you were asking about something like this (in which case your example is very badly chosen because you specify explicitely the type):
template <class T>
void myTemplateFunc(T arg)
{
}
And to use it, you do something like this:
int myValue = 42;
myTemplateFunc(myValue);
But, in fact even in that case there is no matching involved. The compiler will simply 'generate'a new function and replace T by an integer. Now if you call that function and supply a float, then the compiler will generate a second function and replace T by a float. You have to look at templates as code that will be generated by the compiler once you use the template (be it a class or a function). And if you call your function with two different types, then two different functions will be generated.
The only case where a matching is done, is when you use template specialization (if I provide a version of my function specifically for float for example). In that case, the compiler will try to find the best match. But in general, the compiler is quite intelligent to solve the problem on its own.
|
|
|
|
|
Thanks Cédric,
You understand my question well. My question is,
1. for template function, we can choose to use either implicit mode to let compiler deduce or explicit mode to assign type;
2. for template class, we have to use explicit mode to assign type?
regards,
George
|
|
|
|
|
so,
How old are you ?
HOW OLD ARE YOU ?
HOW OLD ARE YOU ?
HOW OLD ARE YOU ?
HOW OLD ARE YOU ?
HOW OLD ARE YOU ?
HOW F***ING OLD ARE YOU ?
|
|
|
|
|
[QUOTE = from the answer to my message]
Sorry Nelek,<br />
I have not made myself fully understood. My question is (after reorganization),
1. for template function, we can choose to use either implicit mode to let compiler deduce or explicit mode to assign type;
2. for template class, we have to use explicit mode to assign type?
[/QUOTE]
Ok, it has logic that if the question was not fully understood, you make the question in another way to try to get the answer you look for. But...
[QUOTE = from the answer to Cedric's message]
Thanks Cédric,<br />
You understand my question well. My question is,
1. for template function, we can choose to use either implicit mode to let compiler deduce or explicit mode to assign type;
2. for template class, we have to use explicit mode to assign type?
[/QUOTE]
If he understood you well, and you got a good answer (IMHO a perfect answer...). WHY DO YOU COPY-PASTE ANOTHER TIME THE SECOND MESSAGE?
And by the way... Why do you never answer to questions (that the people that answer your messages) make to you?
Honestly, I start thinking this user is a BOT.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi Nelek,
I am not a BOT. BOT is not as smart as you and me.
Nelek wrote: user is a BOT
regards,
George
|
|
|
|
|
George_George wrote: BOT is not as smart as you and me.
yeah, sure you aren't. BOT is sure smarter than you
so, answer my previous SIMPLE question, and then i'll consider revising this statement !
modified on Thursday, December 13, 2007 9:19:54 AM
|
|
|
|
|
Hi All,
This is the first time i am writing to this forum.
So let me staight come to the point .
I am a newbie to MFC , but i understand C,C++.
My urgent need of the hour is that i want to provide a text box on my GUI along with a button , and when this button is clicked the data which is shown/typed in the text box is transferred to any kind of USB device viz a viz USB Pen drive's (or any other USB 2.0 compliant class device).
So has any one done similar kind of work and if yes could you'll provide me some good links wherein i will be able to make a GUI which will allow me to talk to the USB device .
Basically the USB API 's which allows us on a click of a control button to send data to a USB device like a USB Pen drive .
Any help in this regards will be highly appreciated.
Regards
A.G
|
|
|
|
|
when this button is clicked the data which is shown/typed in the text box is transferred to any kind of USB device
What does it mean? A TEXT to be transferred to the USB device?
Come online at:-
jubinc@skype
|
|
|
|
|
A USB port is not similar to a serial port. You cannot just get a handle to the bus and send data on it. What you need to do, is get a handle to a specific device driver (using CreateFile) and then you'll be able to exchange data with this specific device (using WriteFile and ReadFile). The string you need to supply to CreateFile is something that is specific for the driver. You should check in the documentation that is supplied with the USB device (if it comes with a SDK).
|
|
|
|
|
Hi Friends,
I am using a CFileDialog, i am giving a path in that.
like..
dlg.m_ofn.lpstrInitialDir = Final_path;
Here i have to Select all the files in the CFileDialog.
How to do that?.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
santhoshv84 wrote: Here i have to Select all the files in the CFileDialog.
How to do that?.
While creating the CFileDialog object, you have to pass the OFN_ALLOWMULTISELECT also( 4th parameter )
|
|
|
|
|
OFN_ALLOWMULTISELECT is not my problem.
While opening the CFileDialog all the files should be selected.
How to do that?.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
derive a class from the CFileDialog and overide the OnFolderChange function. Inside that function take the handle of list control and select all items in it.
|
|
|
|
|
santhoshv84 wrote: While opening the CFileDialog all the files should be selected.
How to do that?.
Programmatically, or using the keyboard/mouse?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Programmatically.
or else
With out the CFileDialog, I have to take all the files in the particular folder in an array. If you know this, let me know.
|
|
|
|
|
santhoshv84 wrote: ...I have to take all the files in the particular folder in an array.
From MSDN:
"If the user selects more than one file, the lpstrFile buffer returns the path to the current directory followed by the file names of the selected files. The nFileOffset member is the offset, in bytes or characters, to the first file name, and the nFileExtension member is not used. For Explorer-style dialog boxes, the directory and file name strings are NULL separated, with an extra NULL character after the last file name."
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
Last time I try to write an application to read a RTF format file and get the text on it. But actually it is not much easy. So I've search on the MSDN and found using CRichViewEdit and its members, it can be easy than my first application.
I've searching some articles on code project forum. But not found such things. If you have any link with you please put it here. Or give some clues to me start work on CRichViewEdit.
Thanks.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Does this http://sourceforge.net/projects/librtf/[^] help?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|