You're right. I had not noticed that.
The book defines two constants:
const int not_a_reading = -7777;
And
const int not_a_month = -1;
and the book actually says:
"""""book"""""""""""""""""
[...]
Why didn't we write
struct Day {
vector<double> hour {24, not_a_reading};
};
That would have been simpler, but unfortunately, we would have gotten a
vector of two elements (24 and -1).
[...]
"""""""""""""""""""""""""
The correct would be
"""""correction"""""""""""""""""
[...]
Why didn't we write
struct Day {
vector<double> hour {24, not_a_reading};
};
That would have been simpler, but unfortunately, we would have gotten a
vector of two elements (24 and -7777).
[...]
"""""""""""""""""""""""""
The author probably confused between not_a_reading and not_a_month.
Verifying that you are right:
$ cat number.cpp
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<double> v {24, -7777};
cout << "Len: " << v.size() << ", v[0]: " << v[0] << ", v[1]: "
<< v[1] << "\n";
}
$ CC number.cpp -std=c++11
$ ./a.out
Len: 2, v[0]: 24, v[1]: -7777
$
I will report this bug in the ppp-public group:
https://groups.google.com/forum/#!forum/ppp-public
Thank you.