Listing 2.71 / interval scope operator inconsistency
Benny Tsang writes:
(Book 2) Section 9.1, Listing 71, when calculating the first hit record (rec1), the "interval::" scope operator may not be needed. In Book 1's Listing 26 (where
interval.hwas first created), the intervaluniversewas not defined within the scope of interval class. It also didn't affect the flow of the chapter, but it would be good to have consistent codes across different chapters.
Hi sir I ran into this issue today. If I actually use "interval::universe" instead of "universe", I would get a Linking Error "1>main.obj : error LNK2001: unresolved external symbol "public: static class interval const interval::universe" (?universe@interval@@2V1@B)"
This error does not happen after I removed the "interval::" before the variable "universe"
I think our two versions of interval.h may be different. The following should be used:
class interval {
...
static const interval empty, universe;
};
const interval interval::empty = interval(+infinity, -infinity);
const interval interval::universe = interval(-infinity, +infinity);
Is this the code that's giving you a link error?
@cccccz The issue has been addressed in dev I'm going to close out this issue. Let us know if you still have any issues.