Pages: « 1 2 3 4 5 6
  Print  
Author Topic: Happy New Year  (Read 10853 times)
Offline (Male) Rusky
Reply #75 Posted on: January 29, 2010, 07:03:32 PM

Resident Troll
Joined: Feb 2008
Posts: 955
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
Yes, templates are useful. But using then for different sizes of an array is just a waste. It's really not any faster to use a constant than a member. I guess if you only used inline functions it wouldn't be a problem, which is a possibility with simple containers. You'd just have to be really careful.
« Last Edit: January 29, 2010, 07:18:31 PM by Rusky » Logged
Offline (Male) RetroX
Reply #76 Posted on: January 29, 2010, 08:46:12 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Yes, templates are useful. But using then for different sizes of an array is just a waste. It's really not any faster to use a constant than a member. I guess if you only used inline functions it wouldn't be a problem, which is a possibility with simple containers. You'd just have to be really careful.
Now that I actually know what templates do, I have to agree.  Unfortunately, there is no storage for typename outside of templates. D:

Also:

Code: [Select]
template<class type1,class type2> function add(type x,type2 y)
 {
 return x+y;
 }

int main()
 {
 int z=add('x',5);
 return 0;
 }

Terrible concept, but yeah.
« Last Edit: January 29, 2010, 08:49:10 PM by RetroX » Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Pages: « 1 2 3 4 5 6
  Print