azure-sdk-for-cpp
azure-sdk-for-cpp copied to clipboard
Add ostream operator << for Azure::Nullable and Azure::DateTime
This came up during a customer study, when customer could not print key vault secret, because he would need to write something like cout << secret.Value.Value.Value.
cout << secret.Value should work, as well as cout << secret.Value.Value.
I.e. both model types should have operator <<, and all the types that they have should have operator << recursively.
Similarly, most common types inside nullable are strings, ints, bools - which all do work with operator << out of the box, and DateTime. Therefore, this work item is to:
- Add ostream operator << for Azure::Nullable
- Add ostream operator << for Azure::DateTime.
A work item to add operator << support for model types will be opened separately (#4694).
The way it would work for nullable: if null, print "null". If not null, call operator << for T.
And look at the std::optional for heavy inspiration.