This question already has an answer here:
A couple of developers and I were wondering why:
std::cout<<std::time<<std::endl;
prints out a value of 1. What does the value represents, and why the value is of 1.
Answer to what happened: How to print function pointers with cout?
The C++ Standard specifies:
4.12 Boolean conversions
1 An rvalue of arithmetic, enumeration, pointer, or pointer to member type can be converted to an rvalue of type bool.
Quote from anon:
This is the only conversion specified for function pointers.
Edit: The answer below nicely presents the solution as to why 1 was printed rather than just any bool and explained when 1 would not occur.
The cppreference says that:
So you get function pointer
std::time
converted tobool
and it is alwaystrue
that is withoutboolalpha
set output as1
.