Hi jonnin,
Thanks for your reply. :+)
I was hoping that:
1. There will be zero overhead for the template stuff, it will happen at compile time? That is, it will select which operators it can use at compile time?
2. I will use a library called GeoLib by Dr Charles F.F. Karney to do the actual geodetic stuff. This library is fast, on my previous i7 machine it could do 1 million Grid to Lat/Long in 1 sec on a single thread. I am also planning to do that on CUDA, my current i9 machine has 3,328 core in the GPU, so if I use 3,000 of them it would cut down that time a lot.
My past use of templates was restricted to basic usage. I have the book "C++ Templates, The Complete Guide" by Vandevoorde, Josuttis, and Gregor, which I definitely need to read much more.
But maybe someone can answer this question easily: I am unsure about the exact scope of template parameters? Even though the template parameters were mentioned in the primary template, I had to mention them again, every time for the operators. Before I had the friend code mentioned above, any mention of another class would result in errors, even when I forward declared the class. I am at work today, I need to try more things when I have more time. What about multiple primary templates:
1 2 3 4 5 6 7 8 9 10 11
|
enum class ZoneNS: unsigned short {North, South};
template<int ZoneId, ZoneNS ZNS >
class UTMGrid;
template<int ZoneId, ZoneNS ZNS>
class UTMGridDelta {
// friend class UTMGrid<ZoneId, ZNS>;
private:
...
| |
This is the same as before, I commented out the friend declaration. Does this I mean I could refer to
UTMGrid
inside the
UTMGridDelta
class, provided that I also have an accessor interface? I should try that.
If that works, I could remove all the friends declarations.
I need to post some code, hopefully this evening, another 8 or 9 hours away.