With future C++ standards, library will switch to std::optional, however
for now we need a wrapper to choose between our bundled implementation,
std::experimental::optional (if that's available) and std::optional
(when that's available)
Style changes:
* Change namespace: std::experimental -> SDL2pp::cpp_optional
* Change _LIBCPP_BEGIN_NAMESPACE_STD to plain "namespace std {"
* Remove _LIBCPP_INLINE_VISIBILITY, _LIBCPP_EXCEPTION_ABI
* Change _NOEXEPT to noexcept
* Address all c++ standard library primitives via std::
Functional changes:
* Change _LIBCPP_ASSERT() to plain assert()
* Remove constexpr from functions which require c++1y relaxed constexpr
requirements
* Change __is_nothrow_swappable condition for noexcept of swap(), to
noexcept(std::swap) (idea taken from libstdc++)
* Remove constexpr from operator-> const to not require
internal __has_operator_addressof
Streams do not generally work well with RWops because
* streams have separate read and write pointers
* ostream doesn't allow you to determine how many bytes were actually written
* istream and ostream have separate set of functions
Try my best to support streams in RWops though, engaging some template
magic:
* provide separate template implementations of all operations which
depend on whether stream is an istream or ostream. This allows to
e.g. return 0 immediately for an attempt to write() to istream.
* disallow StreamRWops for classes which are both istream and ostream
to not run into ambiguity of separate read/write pointers
* for read failure, but partially read object back to the stream to not
lose data for following read (not sure that e.g. fread behaves so
though; I'll anyway expect user to Seek() after read or write failure)
* for write failure, there's no way to avoid leaking partial data to the
stream
In general, it is best to use this container as read-only.
Also add tests for StreamRWops