ldionne updated this revision to Diff 291213. ldionne added a comment. Implement the changes for libc++.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D87459/new/ https://reviews.llvm.org/D87459 Files: libcxx/include/iterator libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp
Index: libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp =================================================================== --- libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp +++ libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/types.pass.cpp @@ -19,6 +19,7 @@ // typedef basic_ostream<charT, traits> ostream_type; // ... +#include <cstddef> #include <iterator> #include <string> #include <type_traits> @@ -34,7 +35,11 @@ #else static_assert((std::is_same<I1::iterator_category, std::output_iterator_tag>::value), ""); static_assert((std::is_same<I1::value_type, void>::value), ""); +#if TEST_STD_VER <= 17 static_assert((std::is_same<I1::difference_type, void>::value), ""); +#else + static_assert((std::is_same<I1::difference_type, std::ptrdiff_t>::value), ""); +#endif static_assert((std::is_same<I1::pointer, void>::value), ""); static_assert((std::is_same<I1::reference, void>::value), ""); #endif @@ -50,7 +55,11 @@ #else static_assert((std::is_same<I2::iterator_category, std::output_iterator_tag>::value), ""); static_assert((std::is_same<I2::value_type, void>::value), ""); +#if TEST_STD_VER <= 17 static_assert((std::is_same<I2::difference_type, void>::value), ""); +#else + static_assert((std::is_same<I2::difference_type, std::ptrdiff_t>::value), ""); +#endif static_assert((std::is_same<I2::pointer, void>::value), ""); static_assert((std::is_same<I2::reference, void>::value), ""); #endif Index: libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp =================================================================== --- libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp +++ libcxx/test/std/iterators/stream.iterators/ostream.iterator/types.pass.cpp @@ -19,6 +19,7 @@ // typedef basic_istream<charT,traits> istream_type; // ... +#include <cstddef> #include <iterator> #include <type_traits> @@ -33,7 +34,11 @@ #else static_assert((std::is_same<I1::iterator_category, std::output_iterator_tag>::value), ""); static_assert((std::is_same<I1::value_type, void>::value), ""); +#if TEST_STD_VER <= 17 static_assert((std::is_same<I1::difference_type, void>::value), ""); +#else + static_assert((std::is_same<I1::difference_type, std::ptrdiff_t>::value), ""); +#endif static_assert((std::is_same<I1::pointer, void>::value), ""); static_assert((std::is_same<I1::reference, void>::value), ""); #endif @@ -47,7 +52,11 @@ #else static_assert((std::is_same<I2::iterator_category, std::output_iterator_tag>::value), ""); static_assert((std::is_same<I2::value_type, void>::value), ""); +#if TEST_STD_VER <= 17 static_assert((std::is_same<I2::difference_type, void>::value), ""); +#else + static_assert((std::is_same<I2::difference_type, std::ptrdiff_t>::value), ""); +#endif static_assert((std::is_same<I2::pointer, void>::value), ""); static_assert((std::is_same<I2::reference, void>::value), ""); #endif Index: libcxx/include/iterator =================================================================== --- libcxx/include/iterator +++ libcxx/include/iterator @@ -1052,9 +1052,19 @@ : public iterator<output_iterator_tag, void, void, void, void> { public: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef basic_ostream<_CharT,_Traits> ostream_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; +#if _LIBCPP_STD_VER > 17 + typedef std::ptrdiff_t difference_type; +#else + typedef void difference_type; +#endif + typedef void pointer; + typedef void reference; + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + private: ostream_type* __out_stream_; const char_type* __delim_; @@ -1151,10 +1161,20 @@ : public iterator<output_iterator_tag, void, void, void, void> { public: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef basic_streambuf<_CharT,_Traits> streambuf_type; - typedef basic_ostream<_CharT,_Traits> ostream_type; + typedef output_iterator_tag iterator_category; + typedef void value_type; +#if _LIBCPP_STD_VER > 17 + typedef std::ptrdiff_t difference_type; +#else + typedef void difference_type; +#endif + typedef void pointer; + typedef void reference; + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + private: streambuf_type* __sbuf_; public:
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits