|
Thank you!
I googled it and have found lots of info now. 
|
|
|
|
|
I'd call it type-erasure really. You're removing all semblance of type information...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I would like to create a template class that takes two template parameters:
1) A typename parameter, T
2) A pointer to a template function, F, that has the following declaration
template<typename U>
U DoSomething(int arg) { ... } With such a declaration, I would like to instantiate my template class as follows:
MyTemplateClass<int, &DoSomething<SomeType>> myInstance; Is there some way to declare MyTemplateClass such that I can infer the typename of SomeType? I have tried the following two cases but receive a compile error for both:
template<typename T, template <typename U> U (*F)(T)>
template<typename T, U (*F<typename U>)(T)> I know that I could add a third template parameter, but would prefer to avoid it if at all possible. Thanks for any assistance,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
No. DoSomething is not a type - it's a function. You're passing a value in, but for a class template, you need to have pre-declared those types.
Sorry and all that, but I don't think there's any way around it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
when im trying to use...
CDialogTemplate dlt;
LPCTSTR ID=_T("IDD_TESTDLG_DIALOG");
if (!dlt.Load(ID)) return -1;
the issue is eventhough the ID is correct but the above if statement returns -1
but if i use
if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1;
the above statement doesn"t return -1..
Please help me regarding the same...
|
|
|
|
|
p_1960 wrote: if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1;
You might change this to:
LPTSTR ID2 = MAKEINTRESOURCE(CTestDlg::IDD);
if (! dlt.Load(ID2)) return -1; and use the preprocessor's output to see if ID2 contains a different value that ID .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks for ur Reply David ....
but the issue is with the below lines..
CDialogTemplate dlt;
LPCTSTR ID=_T("IDD_TESTDLG_DIALOG");
if (!dlt.Load(ID)) return -1;
the above code is returning -1 which is undesirable because ID is correct...
the issue is i have id as String like _T("IDD_TESTDLG_DIALOG")(ie im getting the ID of the resource as a String instead of CTestDlg::IDD) ...
Please correct me if im wrong....
|
|
|
|
|
The point of the exercise was to compare the two (i.e., ID vs. ID2 ). MAKEINTRESOURCE() is a macro that the preprocessor will expand, which is why I suggested a temporary variable.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
ya..but MAKEINTRESOURECE converts an integer value to a resource type ...
but in the case of
CDialogTemplate dlt;
LPCTSTR ID=_T("IDD_TESTDLG_DIALOG");
if (!dlt.Load(ID)) return -1;
i need to pass id as String instead of integer...the doubt it is not working is i send id as
string...
Sorry for inconvenience caused ....
|
|
|
|
|
p_1960 wrote: ya..but MAKEINTRESOURECE converts an integer value to a resource type ...
It returns a LPTSTR .
p_1960 wrote: i need to pass id as String instead of integer...the doubt it is not working is i send id as
string...
Did you look at the preprocessor's output?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
ya it"s not recognising the ID which sent as string but it is working fine if i pass ID AS
integer..
Pls let me know...
|
|
|
|
|
p_1960 wrote: ya...
So what is its output?
p_1960 wrote: ...it"s not recognising the ID which sent as string but it is working fine if i pass ID AS
integer..
Pls let me know...
You may want to re-read this thread to understand exactly what it is that I am asking of you.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Dialog name IDs should be either a string or a 16-bit unsigned integer.
If you remove dialog id definition (#define IDD_TESTDLG_DIALOG number) from the file named "resource.h", it will work. Or you should enter that name with double quotes (like "IDD_TESTDLG_DIALOG") as dialog ID of dialog properties.
|
|
|
|
|
Howdy, slow day today, waiting for a phone call.
I was looking at some code recently, and there was an include like this :
#include "myfile.h"
And I was wondering from what "library" this file comes from. I know I could do a right-click and open and look at the property... but from a code point of view it's not very practical (IMO).
So, I looked in the project's settings to see that there are about 25 lines of "additional include paths", one for each library we have:
for example :
../lib/lib1
../lib/lib2
../lib/lib3
../lib/lib4
So, the questions :
Is it best practice to limit the number of "additional include path" to a minimum and have more descriptive include directive in the code ?
for example :
in the project settings :
../lib
and in the code have this :
#include "lib1/myfile.h"
#include "lib2/myfile2.h"
Is there a compilation performance issue with having a large amount of include paths vs. having more descriptive
includes in the code ?
Any good reading about this topic available somewhere ?
Thanks.
This signature was proudly tested on animals.
|
|
|
|
|
Maximilien wrote: in the project settings :
../lib
and in the code have this :
#include "lib1/myfile.h"
#include "lib2/myfile2.h"
That's what I'd likely go for
Best practise? Is there one? I don't think so. But in the *nix world, they tend to use that pattern. For example, in my Mac's /usr/include directory, there are 267(!) directories for different libraries (like libxml, libxslt, rpc, subversion, python).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I would like to get all text values from my MS Access database, I can access directly each column value (ie: str[0] = FF_Text.m_Column1, str[1] = FF_Text.m_Column2, ...)
But instead do like that for 27 times ... I would like to access them through their columns! However, I could not find the way to retrieve column text value!
CString str[27];
strSQL.Format ("SELECT * FROM TABLE_Text WHERE Title = 'Information'");
FF_Text.Open (AFX_DAO_USE_DEFAULT_TYPE, strSQL, 0);
if (!FF_Text.IsEOF())
{
for (i=0; i<27; i++)
{
str[i] = FF_Text.(???)
}
}
FF_Text.Close();
Can any one help?
|
|
|
|
|
ATC2000 wrote: str[i] = FF_Text.(???) // Get text value in intended column
Are you looking for the GetFieldValue() method?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I did try before but forgot to examine the error (not well define). Now it is OK, I got all column text!
Thanks for help 
|
|
|
|
|
Hi all,
I am trying to use the IGPM interface from the gpmgmt.dll. The dll is registered in Win2008 server. But when I execute my exe file (written in C++) it simply throws an HRESULT error - "0x80040154 The class is not regsiteresd" and the GetLastError returns "1008 ERROR_NO_TOKEN".
Any help is appriciated.
Thanks.
Subha
|
|
|
|
|
Hi,
I created a tab control using Win32 , I require to add X button and h-scroll(Right top corner) as in VS2005 IDE. can any one give a idea how to Override tab control, X button like IE7 will also be good.
Thanks in advance.
Birajendu
SonicWALL
Bangalore
India
|
|
|
|
|
std::list < xlong > ClientConfig:: GetHistory(int id)
{
....
doing something
....
return 0;
}
When the above code is compailed in VS 2005 (VC++), following is the error
error C2664: 'stlp_std::list<_Tp>::list(const stlp_std::list<_Tp> &)' : cannot convert parameter 1 from 'int' to 'const stlp_std::list<_Tp> &'
with
[
_Tp=xlong
]
Reason: cannot convert from 'int' to 'const stlp_std::list<_Tp>'
with
[
_Tp=xlong
]
Constructor for class 'stlp_std::list<_Tp>' is declared 'explicit'
with
[
_Tp=xlong
]
resdata.cpp
I tried to return xlong value, but still getting the same error
Can any once help to fix the same
|
|
|
|
|
Look at what the function is supposed to return (a std::list<xlong>) and look at what you are actually returning (an integer). IF you want this to work, you either have to change the return type to long or return a std::list<xlong> object form your function.
|
|
|
|
|
Can I open different dialogs in an application and have them remain open?
I am trying to avoid using MDI.
Or do I have to open different instances of my application and use IPC to communicate between them?
Can someone help please?
Thanks.
|
|
|
|
|
What are you trying to achieve exactly ? Do you want multiple dialogs on which the user can interract at the same time ? If yes, then your dialogs have to be modeless dialogs.
But this has nothing to do with MDI, so I don't see why you are talking about that . Maybe I didn't understand your question correctly.
|
|
|
|
|
Thank you. Yes Modeless is what I was looking for.
I am sorry If I confused you.
|
|
|
|