I want to make a type to differentiate degrees and radians. I wanted something like this to produce a compiler error:
#include <iostream>
typedef double Degree;
typedef double Radian;
void MyFunction(Radian angle);
int main()
{
Degree foo = 3.0;
return 0;
}
void MyFunction(Radian angle)
{
std::cout << "Success." << std::endl;
}
But the typedef just translates directly to "double" so there is no problem passing a Degree to a function expecting a Radian.
I could make a struct and do
Radian foo;
foo.value = 3;
MyFunction(foo);
...
void MyFunction(Radian r);
But then I always have this ".value" hanging around everywhere. Is there no way to do what I'm looking to do?
Thanks,
Dave