|
-
April 1st, 2008, 03:32 PM
#1
typedef usage
typedef hash_map<int, list<string> > EXCEL_ROW;
EXCEL_ROW row;
why is typedef used here?
couldn't i just say...
hash_map<int, list<string> > row;
Does it have any additional advantage to use the typedef method..
Last edited by armen_shlang; April 1st, 2008 at 03:35 PM.
-
April 1st, 2008, 03:41 PM
#2
Re: typedef usage
 Originally Posted by armen_shlang
typedef hash_map<int, list<string> > EXCEL_ROW;
EXCEL_ROW row;
why is typedef used here?
1) It is more easier to read,
2) If you changed the typedef from hash_map to a std::map, you don't have to change all of your code also.
3) it doesn't wear out your keyboard having to type
"hash_map<int, list<string> >"
all over the place.
Regards,
Paul McKenzie
-
April 2nd, 2008, 04:21 AM
#3
Re: typedef usage
In addition to what Paul said ...
 Originally Posted by armen_shlang
couldn't i just say...
hash_map<int, list<string> > row;
string is a typedef, so you could also write:
Code:
hash_map<int, list<basic_string<char> > > row;
As you can see, typedef makes it easier to read the code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|