943,596 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 7134
  • C++ RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Oct 10th, 2008
1

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

Click to Expand / Collapse  Quote originally posted by Rhohitman ...
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
Reputation Points: 12
Solved Threads: 5
Junior Poster in Training
gregorynoob is offline Offline
86 posts
since Jun 2008
Oct 10th, 2008
0

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

Click to Expand / Collapse  Quote originally posted by ArkM ...
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

C++ Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
Rhohitman is offline Offline
81 posts
since Dec 2007
Oct 10th, 2008
0

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

Click to Expand / Collapse  Quote originally posted by ArkM ...
Hehe...
C++ Syntax (Toggle Plain Text)
  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..
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
Rhohitman is offline Offline
81 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: number of ways to..ehh, i hate counting ways
Next Thread in C++ Forum Timeline: Using c++ to send email with smtp





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC