The compiler keeps complaining it cannot understand one operator<< manipulator if it is in one order, but accepts it if it is in a different order or statement. But the error code is cryptic, it finds the correct function signature among candidates but gets lost in a string of parenthesized signatures that make little sense because it does not say exactly where it got lost. So, this code passes well:
HWND h = NULL; box << manipulator(h);
This chain also passes well:
HWND h = NULL; char *XXX = ""; box << manipulator(h) << XXX;
But this code fails:
HWND h = NULL; char *XXX = ""; box << XXX << manipulator(h);//different chain order OK!
In general it gives error or passes dependending on the order of insertions when order of insertions (and objects inserted) should not matter.
It would be easier if the compiler gives a clearer error code, but as it stands the compiler is even trying to synthesize an operator+ and includes a coma (,) operator.
no match for 'operator<<' in 'std::operator<< [with _Traits = std::char_traits<char>](((std::basic_ostream<char, std::char_traits<char> >&)((std::basic_ostream<char, std::char_traits<char> >*)(&box))), ((const char*)XXX)) << manipulator [with typet = HWND__*](h)'
Can anyone explain what is the compiler trying to say here?