[libc++] Move fpos into its own header
For some reason `<string>` defines `std::fpos`, which should be defined in `<ios>`.
Reviewed By: Quuxplusone, Mordante, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D118914
NOKEYCHECK=True
GitOrigin-RevId: 679f8a885b65e0c82537590f1d88c2bc4c6869bc
diff --git a/include/string b/include/string
index d196137..4f3815f 100644
--- a/include/string
+++ b/include/string
@@ -521,6 +521,7 @@
#include <__config>
#include <__debug>
#include <__functional_base>
+#include <__ios/fpos.h>
#include <__iterator/wrap_iter.h>
#include <algorithm>
#include <compare>
@@ -538,11 +539,11 @@
#include <version>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-# include <cwchar>
+# include <cwchar>
#endif
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-# include <cstdint>
+# include <cstdint>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -555,43 +556,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-// fpos
-
-template <class _StateT>
-class _LIBCPP_TEMPLATE_VIS fpos
-{
-private:
- _StateT __st_;
- streamoff __off_;
-public:
- _LIBCPP_INLINE_VISIBILITY fpos(streamoff __off = streamoff()) : __st_(), __off_(__off) {}
-
- _LIBCPP_INLINE_VISIBILITY operator streamoff() const {return __off_;}
-
- _LIBCPP_INLINE_VISIBILITY _StateT state() const {return __st_;}
- _LIBCPP_INLINE_VISIBILITY void state(_StateT __st) {__st_ = __st;}
-
- _LIBCPP_INLINE_VISIBILITY fpos& operator+=(streamoff __off) {__off_ += __off; return *this;}
- _LIBCPP_INLINE_VISIBILITY fpos operator+ (streamoff __off) const {fpos __t(*this); __t += __off; return __t;}
- _LIBCPP_INLINE_VISIBILITY fpos& operator-=(streamoff __off) {__off_ -= __off; return *this;}
- _LIBCPP_INLINE_VISIBILITY fpos operator- (streamoff __off) const {fpos __t(*this); __t -= __off; return __t;}
-};
-
-template <class _StateT>
-inline _LIBCPP_INLINE_VISIBILITY
-streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
- {return streamoff(__x) - streamoff(__y);}
-
-template <class _StateT>
-inline _LIBCPP_INLINE_VISIBILITY
-bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
- {return streamoff(__x) == streamoff(__y);}
-
-template <class _StateT>
-inline _LIBCPP_INLINE_VISIBILITY
-bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
- {return streamoff(__x) != streamoff(__y);}
-
// basic_string
template<class _CharT, class _Traits, class _Allocator>