j
k
j a
j l
hi please compile this program: #include #include <iostream> #include <vector> using namespace boost::posix_time; using namespace std; #define x(v) cout << #v << " : " << (v) << '\n'; int main(int argc, char *argv[]) { time_duration a(not_a_date_time); time_duration b; x(ab); x(a<=b); x(a>=b); x(ba); x(b<=a); x(b>=a); x(a==b); x(b==a); x(a.is_special()); x(b.is_special()); vector v0, v1; v0.push_back(time_duration()); v0.push_back(time_duration(not_a_date_time)); sort(v0.begin(), v0.end()); v1.push_back(time_duration(not_a_date_time)); v1.push_back(time_duration()); sort(v1.begin(), v1.end()); x(v0==v1); return 0; } the output is: ab : 0 a<=b : 1 a>=b : 1 ba : 0 b<=a : 1 b>=a : 1 a==b : 0 b==a : 0 a.is_special() : 1 b.is_special() : 0 v0==v1 : 0 if the time_duration datatype is a complete partial order which is for example needed for it to be able to be sorted, then the above output is partly illegal: if not a
Back to the thread
Back to the list