3.15.2.3.1. Any Class Example
class Any
{
public:
// Types passed by value are easy
void operator <<= (Any &, Short);
Boolean operator >>= (const Any &, Short &);
...
// Types passed by reference introduce ownership issues
void operator <<= (Any &, const Any &);
void operator <<= (Any &, Any *);
...
// Types where overloading fails introduce resolution issues
struct from_boolean { from_boolean (Boolean b) : val (b) { } Boolean val; };
struct from_octet { from_octet (Octet o) : val (o) { } Octet val; };
struct from_char { from_char (Char c) : val (c) { } Char val; };
...
void operator <<= (from_boolean);
void operator <<= (from_octet);
void operator <<= (from_char);
...
struct to_boolean { to_boolean (Boolean &b) : ref (b) { } Boolean &ref; };
...
Boolean operator >>= (to_boolean) const;
...
private:
// Private operators can detect resolution issues
unsigned char void operator <<= (unsigned char);
Boolean operator >>= (unsigned char &) const;
}