- Mar 31, 2003
- 11,679
- 0
- 81
I am trying to do a basic Math Conversions class in C++. I have enumerated values declared for each of my sets (Weight{kg,g,lbs}, Angle{degrees,radians}, etc...).
When I call the function as of right now I have 2 calls:
1. setConversion( enum ) which has, as of right now, 4 overloaded versions. This merely sets the value that I will be multiplying by.
2. (inline) convertProcess( structure ) which has 2 overloaded versions - 1 of which takes an array and 1 of which takes a vector<vector<double>>. This merely takes the value that was set from the setConversion() call and multiplies it (via SSE Intrinsics) to each value in the structure.
Instead of having a ton of overloaded members, is there anyway to send a generic enumerated type into the setConversions() function that is type safe (So they don't convert from feet to pounds)?
I don't see anyway around having to do 2 function calls given that this will need to work seamlessly with both array's and vectors.
Thanks,
-Kevin
When I call the function as of right now I have 2 calls:
1. setConversion( enum ) which has, as of right now, 4 overloaded versions. This merely sets the value that I will be multiplying by.
2. (inline) convertProcess( structure ) which has 2 overloaded versions - 1 of which takes an array and 1 of which takes a vector<vector<double>>. This merely takes the value that was set from the setConversion() call and multiplies it (via SSE Intrinsics) to each value in the structure.
Instead of having a ton of overloaded members, is there anyway to send a generic enumerated type into the setConversions() function that is type safe (So they don't convert from feet to pounds)?
I don't see anyway around having to do 2 function calls given that this will need to work seamlessly with both array's and vectors.
Thanks,
-Kevin