setprecision(4)
causes
inline smanip setprecision(int n){ return smanip(set_precision,n); }
What creates smanip from a pointer to the set_precision and n functions.
struct smanip{ ios_base& (*f) (ios_base&, int); int i; smanip(ios_base& (*ff)(ios_base&, int), int ii) : f(ff), i(ii){} };
smanip is a structure that contains a pointer to a function and an integer. This function takes ios_base by reference and int and returns ios_base by reference.
At this point, the line effectively looks like this:
smanip m(&setprecision, 4); cout << m << (otherstuff);
which matches this pattern:
template<class Ch, class Tr> ostream<Ch, Tr>& operator<<(ostream<Ch, Tr>& os, smanip& m){ return mf(os, mi); }
And the compiler can output Ch and Tr from the stream on the left side. In this case, std::cout . The code is executed by mf(os, mi) . This calls the function pointer held by smanip , passing it the stream and the integer held by smanip .
ios_base& set_precision(ios_base& s, int n){ return s.setprecision(n);
This calls cout.setprecision(n) .
Thus, the string is converted to:
std::cout.setprecision(4) << angle;