How to use typedef for the template structure? What its syntax?

Reply

Join Date: Jun 2008
Posts: 86
Reputation: gregorynoob is an unknown quantity at this point 
Solved Threads: 5
gregorynoob gregorynoob is offline Offline
Junior Poster in Training

Re: How to use typedef for the template structure? What its syntax?

 
1
  #11
Oct 10th, 2008
Originally Posted by Rhohitman View Post
I didn't get what your syntax says.
Can you kindly explain it..
umm, sorry if it was not understandable, i tried to come up with a very long name for a type i want to define... so i made the name myself, don't try it it won't work. unless you define such a class. which would be silly... c++ isn't java
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 68
Reputation: Rhohitman is an unknown quantity at this point 
Solved Threads: 4
Rhohitman's Avatar
Rhohitman Rhohitman is offline Offline
Junior Poster in Training

Re: How to use typedef for the template structure? What its syntax?

 
0
  #12
Oct 10th, 2008
Originally Posted by ArkM View Post
Typedef name is an alias for the type, it's not a new type name.
Can you explain what a problem are you trying to solve with "generic typedef"?
I got your point..
But lets say If i want to create the pointer variable.
like for example normally what we do is

  1. struct box
  2. {
  3. ... blah .. blah.. blah
  4. };
  5.  
  6. typedef box *crazy_box;
  7. //as we can now easy create the pointer with crazy_box
  8. crazy_box B1;

Now I want this to happen with the template structure what to do...
Last edited by Rhohitman; Oct 10th, 2008 at 7:23 pm.
Chazing Dreams ;'P
Shhhh.......ZZzzzzzzzzzzzzzzzzzzzz.....
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 68
Reputation: Rhohitman is an unknown quantity at this point 
Solved Threads: 4
Rhohitman's Avatar
Rhohitman Rhohitman is offline Offline
Junior Poster in Training

Re: How to use typedef for the template structure? What its syntax?

 
0
  #13
Oct 10th, 2008
Originally Posted by ArkM View Post
Hehe...
  1. template<typename T>
  2. struct MyGreatBeautifulBox:box<T>{};
  3.  
  4. int main()
  5. {
  6. MyGreatBeautifulBox<int> ibox;
  7. MyGreatBeautifulBox<char> cbox;
Hey that Cheating. This is not what i meant for..
Chazing Dreams ;'P
Shhhh.......ZZzzzzzzzzzzzzzzzzzzzz.....
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC