|
template<class T1, class T2 = T1> class X2
{
};
please explain what it means (class T2 = T1)?
|
|
|
|
|
If you are not specifying the type T2, then it will be T1...
Like X2<int> a;
same as X2<int,int> a;
|
|
|
|
|
|
Consider the following example
template<class class="" t2="T1"> class X
{
public:
T1 a;
T2 b;
};
void main()
{
X<int> m1;
m1.a = 10;
m1.b = 10;
X<int,float> m2;
m2.a = 10;
m2.b = 10.0;
}</class>
Here m1 is having both members as int type. It is created as X<int>, means T1 is int, and T2 which is not specified explicitly, became the default type. That is T1, which is int. So T2 is also int.
In the second case, m2, T1 is int and T2 is specified as float explicitly. Now T2 is float.
Hope now it is clear.
|
|
|
|
|
|
template<class T1, class T2 = T1> class X2 {};
T2 is an optional parameter hence class X2 will be specialised using <t1,> if T2 is not specified,
for instance
X2 <int> x2;
is the same of
X2 <int, int> x2;
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
My application is currently working on Vista. When I invoke through Domain1\user1 , it works fine.
When I log as DOMAIN2\user and try to invoke my application it crashes.
I have a observations. In one of the dll which is being used while application is invoked, I changed project settings. I have set Optimization settings as Minimize size. When I rebuid the binary and replace it. Now the application is working fine even as DOMAIN2\user2.
Can I know why this behaviour difference and how did crash get solved.
I am using VC++6.0 on Vista.
Thanks.
|
|
|
|
|
Unless there is a compiler bug (very unlikely) you have a bug in your code that only shows up with optimizations on. Likely this is some kind of memory allocation bug. Impossible to say without seeing your code.
|
|
|
|
|
Hi,
I cannot get VS2005 to work properly on my Vista when I use the dialog app wizard, nothing happens - I have the Sp1 update etc installed for VS. Can someone tell me if there is a workaround for me to get the files the wizard would create, including a blank resource template that I can visually drag and drop controls onto, and if there are still any issues with linking controls to code as I've seen before (I've not had VS installed for ages, and only previously on XP). Would these issues go away on an XP based system.
thanks for any help
cheers
Lee
|
|
|
|
|
Hi all,
This only happens on the release version of my project and it does not happen on the debug version. Also I have the same additional dependencies.
SiteCode.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl hash(char *)" (?hash@@YAIPAD@Z) referenced in function "public: int __thiscall CSiteCode::ReportNICInfoMP(int,class CDeviceLocationInformationList &,class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > &,char *)" (?ReportNICInfoMP@CSiteCode@@QAEHHAAVCDeviceLocationInformationList@@AAV?$CStringT@_WV?$StrTraitATL@_WV?$ChTraitsCRT@_W@ATL@@@ATL@@@ATL@@PAD@Z)
1>SiteCode.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl calc_hashnr_new(char const *,unsigned int)" (?calc_hashnr_new@@YAIPBDI@Z) referenced in function "public: int __thiscall CSiteCode::ReportNICInfoMP(int,class CDeviceLocationInformationList &,class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > &,char *)" (?ReportNICInfoMP@CSiteCode@@QAEHHAAVCDeviceLocationInformationList@@AAV?$CStringT@_WV?$StrTraitATL@_WV?$ChTraitsCRT@_W@ATL@@@ATL@@@ATL@@PAD@Z)
1>SiteCode.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl calc_hashnr(char const *,unsigned int)" (?calc_hashnr@@YAIPBDI@Z) referenced in function "public: int __thiscall CSiteCode::ReportNICInfoMP(int,class CDeviceLocationInformationList &,class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > &,char *)" (?ReportNICInfoMP@CSiteCode@@QAEHHAAVCDeviceLocationInformationList@@AAV?$CStringT@_WV?$StrTraitATL@_WV?$ChTraitsCRT@_W@ATL@@@ATL@@@ATL@@PAD@Z)
1>SiteCode.obj : error LNK2019: unresolved external symbol "unsigned long __cdecl hashpjw(char *,unsigned int)" (?hashpjw@@YAKPADI@Z) referenced in function "public: int __thiscall CSiteCode::ReportNICInfoMP(int,class CDeviceLocationInformationList &,class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > &,char *)" (?ReportNICInfoMP@CSiteCode@@QAEHHAAVCDeviceLocationInformationList@@AAV?$CStringT@_WV?$StrTraitATL@_WV?$ChTraitsCRT@_W@ATL@@@ATL@@@ATL@@PAD@Z)
1>SiteCode.obj : error LNK2019: unresolved external symbol "void __cdecl Add2ByteChecksum(unsigned char *)" (?Add2ByteChecksum@@YAXPAE@Z) referenced in function "public: class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CSiteCode::GetMPSiteCode(class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?GetMPSiteCode@CSiteCode@@QAE?AV?$CStringT@_WV?$StrTraitATL@_WV?$ChTraitsCRT@_W@ATL@@@ATL@@@ATL@@V23@@Z)
1>SiteCode.obj : error LNK2019: unresolved external symbol "int __cdecl EncryptDecrypt(unsigned char *,unsigned int,unsigned char,unsigned char)" (?EncryptDecrypt@@YAHPAEIEE@Z) referenced in function "public: class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __thiscall CSiteCode::GetMPSiteCode(class ATL::CStringT<wchar_t,class ATL::StrTraitATL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?GetMPSiteCode@CSiteCode@@QAE?AV?$CStringT@_WV?$StrTraitATL@_WV?$ChTraitsCRT@_W@ATL@@@ATL@@@ATL@@V23@@Z)
1>D:\SVN\Licensin System\Work Package\UpdateManager\Release\UpdateService.exe : fatal error LNK1120: 6 unresolved externals
Thanks,
Jonathan
|
|
|
|
|
monsieur_jj wrote: Also I have the same additional dependencies.
Did you forget to add them in the release settings ? Remember that you have to add them both for the debug version and the release version.
|
|
|
|
|
Hello,
I am currently writing a piece of software that needs to know if it is still running on the same PC as it was installed, or if it has been moved or the hardware has changed.
At the moment, I use the PCs network card MAC address, which usually works fine, but fails when the user changes network cards. This can happen if users use docking-stations with seperate NICs, or USB WLAN adapters, so I'd like to not use the MAC address anymore for system identification.
So the question is: are there other suitable ways to uniquely determine a PC? Is there a description of the way Microsoft uses to identify a PC when activating XP or Vista, which seems to work quite well, even if I change my network card my Windows stays activated, only if I do major changes to my hardware like changing the motherboard I will have to reactivate.
So I'd like to do it a similar way. Any hints how I can do this?
Thanks alot,
Erik
|
|
|
|
|
You could try using the computer SID.
|
|
|
|
|
Some (but not all) processors have an ID number. (I seem to remember reading Intel processors had it, but not AMD). You could use the volume-serial number, but this will change if the user replaces the hard disk.
I got the impression that Microsoft looks at multiple sources of identification, and detects a change when a certain threshold of things have changed. This allows you to replace a couple of components without the application breaking.
|
|
|
|
|
This is part of the holy grail for copy protection - it doesn't exist.
MS gets the info from a bunch of hardware on your system and assigns points to each.
e.g.
- How much ram, what type ...
- Graphic card specs
- CPU specs
- Monitor specs
- NIC MAC
The items that are considered to be fairly consistant over the life of a machine receive more points than others e.g. MAC may have a higher point value than the amount of memory.
The license manager checks the current settings against the previous ones (not just the last) and looks at the difference in terms of 'points changed in x amount of time'. If too many points have changed it assumes you are running on a different machine.
[EDIT]
http://www.licenturion.com/xp/fully-licensed-wpa.txt[^]
http://kb.wisc.edu/helpdesk/page.php?id=5294[^]
http://www.microsoft.com/downloads/details.aspx?FamilyID=5cb10f03-27f6-461d-a3db-d440b4ced7f6&DisplayLang=en[^]
[/EDIT]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
modified on Wednesday, December 10, 2008 12:24 PM
|
|
|
|
|
Dear friends;
How i can set my current date(Y,M,D), to a file name in c++ (DOS)?
Such as "20081210.txt".
Thanks.
|
|
|
|
|
Like this
<code>
int main()
{
struct tm *t;
time_t lt;
time(& lt);
t = localtime(<);
}
</code><pre>
do not forget to include "time.h"
<div class="ForumSig">You need to google first, if you have "It's urgent please" mentioned in your question.
;-)_AnShUmAn_
</div>
|
|
|
|
|
I ran across a project in VC 5.0 source that I could really use, but I don't have a compiler. Can someone compile this little command line tool for me and send me the binary?
http://www.codeproject.com/KB/applications/iniutils.aspx
Thanks!
David
|
|
|
|
|
Hi,
I have an application in which i have a editbox and data for it will be populated dynamically ,i have verticall scroll applied for it,now my problem is i want that scroll to be visible only if the length of the data coming into the editbox exceeds the length of the editbox.
Can anybody suggest a right approach for this?
Thanks in advance.
modified on Wednesday, December 10, 2008 3:28 AM
|
|
|
|
|
guys, can you give me some idea on how to control video recorder using VC++ and MFC..
for example, there is a video recorder connected to the pc, i want to create an application that can make that recorder to play, stop, pause, record, rewind and forward..
How can i do this?? i really dont have any idea...
|
|
|
|
|
I believe the first question that arises here would be: HOW is the recorder connected to the PC?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
the only way i can think is by connecting it by USB.... or anything, just to be able to create the program..
|
|
|
|
|
To control any device you would need specifications of the protocols the device used to communicate with the PC.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
and is that dependent on the hardware?? i mean, for example, different brands have different specifications, and different way to access?? this is gonna be harder that i thought... waa..
|
|
|
|
|