I am working on an alternative implementation of input/output streams that have similar semantics to std::istream and std::ostream (for size reasons - on my microcontroller instantiating an std::iostream uses up 140KB, or roughly half of my available flash memory).

One thing I really want to support is using std::endl for a more seamless experience for users of my library, who will most likely already have experience using std::iostream. I understand that it will be hacky, but is there a standard compliant way of doing that?

According to cppreference std::endl is defined like this:
Code:
template< class CharT, class Traits >
std::basic_ostream<CharT, Traits>& endl( std::basic_ostream<CharT, Traits>& os );
So technically I think I can add an overload to my library like this:
Code:
MyStream& operator<<(std::function<std::ostream&(std::ostream&)> f) {
   ...
}
But then how would I be able to tell that it's endl vs any other io manipulator (which I don't want/need to support)?

Thanks