codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Template  dickyDick at 19:51 on Thursday, July 28, 2005
 

Hi all,

I am having trouble with class definition with template. The following is a simple example:


template <class DataType>
struct TestStruct {
DataType key;
};

template <class s, class d>
class DummyClass {
public:
d getKey(s<d> *var) {
return var->key = 10;
}
};

int main() {
DummyClass<TestStruct, double> myClas;
return 0;
}

It produces an error because of s<d>.

If I write:


template <class DataType>
struct TestStruct {
DataType key;
};

template <class s, class d>
class DummyClass {
public:
d getKey(s *var) {
return var->key = 10;
}
};

int main() {
DummyClass<TestStruct<double>, double> myClas;
return 0;
}

It works just fine. But that is not I want because I need to use "double" twice. Can anyone help?

  Re: Template  vector at 12:36 on Saturday, May 20, 2006
 

what do you mean u need to use double twice??

s<d> is wrong that is why it's no working








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  onChange issue
•  Remote program execution using cgi-perl
•  Chat application
•  How to send multiple perameters in SOAP request.
•  Java code for Insert picture on the table in spreadsheet
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime
•  help me
•  pls help me with this..


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007