![]() |
| ||
| How to use typedef for the template structure? What its syntax? I create the simple template structure like this #include <iostream> Now i want to use the typedef for this template structure. I could not figure out the syntax... as i tried typedef box square; But i didn't workout... Please help me..:'( |
| ||
| Re: How to use typedef for the template structure? What its syntax? I don't think it's in the language. You could use #define square box. You may want to google template typedefs, or check out http://www.gotw.ca/gotw/079.htm for some solutions. |
| ||
| Re: How to use typedef for the template structure? What its syntax? Quote:
|
| ||
| Re: How to use typedef for the template structure? What its syntax? What's a problem? typedef box<int> MyFavouriteBoxType;Look at STL headers on you C++ installation. There are lots of (useful) typedefs in STL templates... |
| ||
| Re: How to use typedef for the template structure? What its syntax? yea, you gotta either macro it or typedef with specifying the actual template type :P sucks in a way... but hey, what's the deal with the box thing, it's pretty small and easy to write... i use typedef for long, looooong names, like: typedef my_monumental_structure<another_huge_type>::iterator sit;and then i just sit... all the way... rocks |
| ||
| Re: How to use typedef for the template structure? What its syntax? Quote:
|
| ||
| Re: How to use typedef for the template structure? What its syntax? Quote:
Can you kindly explain it.. |
| ||
| Re: How to use typedef for the template structure? What its syntax? 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"? |
| ||
| Re: How to use typedef for the template structure? What its syntax? I believe he's trying to do something like: typedef box MyGreatBeautifulBox; I don't think it can be done |
| ||
| Re: How to use typedef for the template structure? What its syntax? Hehe... template<typename T> |
| All times are GMT -4. The time now is 8:00 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC