[libcxx-commits] [libcxx] 6abc15a - [libc++] Reduce dependencies on <iostream> from <random>

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 15 10:40:31 PDT 2020


Author: Louis Dionne
Date: 2020-10-15T13:40:18-04:00
New Revision: 6abc15ae3c245b6043f15d3cdedfad187888dfd5

URL: https://github.com/llvm/llvm-project/commit/6abc15ae3c245b6043f15d3cdedfad187888dfd5
DIFF: https://github.com/llvm/llvm-project/commit/6abc15ae3c245b6043f15d3cdedfad187888dfd5.diff

LOG: [libc++] Reduce dependencies on <iostream> from <random>

We included <istream> and <ostream> from <random>, but really it is
sufficient to include <iosfwd> if we make sure we access ios_base
members through a dependent type. This allows us to break a hard
dependency of <random> on locales.

Added: 
    

Modified: 
    libcxx/include/ios
    libcxx/include/iosfwd
    libcxx/include/random

Removed: 
    


################################################################################
diff  --git a/libcxx/include/ios b/libcxx/include/ios
index 7f0e2d65e6406..ae758ddb35ef7 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -1035,33 +1035,6 @@ defaultfloat(ios_base& __str)
     return __str;
 }
 
-template <class _CharT, class _Traits>
-class __save_flags
-{
-    typedef basic_ios<_CharT, _Traits> __stream_type;
-    typedef typename __stream_type::fmtflags fmtflags;
-
-    __stream_type& __stream_;
-    fmtflags       __fmtflags_;
-    _CharT         __fill_;
-
-    __save_flags(const __save_flags&);
-    __save_flags& operator=(const __save_flags&);
-public:
-    _LIBCPP_INLINE_VISIBILITY
-    explicit __save_flags(__stream_type& __stream)
-        : __stream_(__stream),
-          __fmtflags_(__stream.flags()),
-          __fill_(__stream.fill())
-        {}
-    _LIBCPP_INLINE_VISIBILITY
-    ~__save_flags()
-    {
-        __stream_.flags(__fmtflags_);
-        __stream_.fill(__fill_);
-    }
-};
-
 _LIBCPP_END_NAMESPACE_STD
 
 #endif  // _LIBCPP_IOS

diff  --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd
index 0ffe75f197c35..070fbe8bfad8d 100644
--- a/libcxx/include/iosfwd
+++ b/libcxx/include/iosfwd
@@ -215,6 +215,33 @@ typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring
 template <class _Tp, class _Alloc = allocator<_Tp> >
 class _LIBCPP_TEMPLATE_VIS vector;
 
+template <class _CharT, class _Traits>
+class __save_flags
+{
+    typedef basic_ios<_CharT, _Traits> __stream_type;
+    typedef typename __stream_type::fmtflags fmtflags;
+
+    __stream_type& __stream_;
+    fmtflags       __fmtflags_;
+    _CharT         __fill_;
+
+    __save_flags(const __save_flags&);
+    __save_flags& operator=(const __save_flags&);
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    explicit __save_flags(__stream_type& __stream)
+        : __stream_(__stream),
+          __fmtflags_(__stream.flags()),
+          __fill_(__stream.fill())
+        {}
+    _LIBCPP_INLINE_VISIBILITY
+    ~__save_flags()
+    {
+        __stream_.flags(__fmtflags_);
+        __stream_.fill(__fill_);
+    }
+};
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif  // _LIBCPP_IOSFWD

diff  --git a/libcxx/include/random b/libcxx/include/random
index 4321195c4f0ee..9ba1693e2059f 100644
--- a/libcxx/include/random
+++ b/libcxx/include/random
@@ -1642,8 +1642,7 @@ class piecewise_linear_distribution
 #include <numeric>
 #include <vector>
 #include <string>
-#include <istream>
-#include <ostream>
+#include <iosfwd>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -1982,7 +1981,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left);
+    typedef basic_ostream<_CharT, _Traits> _Ostream;
+    __os.flags(_Ostream::dec | _Ostream::left);
     __os.fill(__os.widen(' '));
     return __os << __x.__x_;
 }
@@ -1994,7 +1994,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
            linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     _UIntType __t;
     __is >> __t;
     if (!__is.fail())
@@ -2453,7 +2454,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
                                          _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left);
+    typedef basic_ostream<_CharT, _Traits> _Ostream;
+    __os.flags(_Ostream::dec | _Ostream::left);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.__x_[__x.__i_];
@@ -2474,7 +2476,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
                                    _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     _UInt __t[_Np];
     for (size_t __i = 0; __i < _Np; ++__i)
         __is >> __t[__i];
@@ -2773,7 +2776,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left);
+    typedef basic_ostream<_CharT, _Traits> _Ostream;
+    __os.flags(_Ostream::dec | _Ostream::left);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.__x_[__x.__i_];
@@ -2792,7 +2796,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
            subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     _UInt __t[_Rp+1];
     for (size_t __i = 0; __i < _Rp+1; ++__i)
         __is >> __t[__i];
@@ -2955,7 +2960,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const discard_block_engine<_Eng, _Pp, _Rp>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left);
+    typedef basic_ostream<_CharT, _Traits> _Ostream;
+    __os.flags(_Ostream::dec | _Ostream::left);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     return __os << __x.__e_ << __sp << __x.__n_;
@@ -2968,7 +2974,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
            discard_block_engine<_Eng, _Pp, _Rp>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     _Eng __e;
     int __n;
     __is >> __e >> __n;
@@ -3440,7 +3447,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const shuffle_order_engine<_Eng, _Kp>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left);
+    typedef basic_ostream<_CharT, _Traits> _Ostream;
+    __os.flags(_Ostream::dec | _Ostream::left);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.__e_ << __sp << __x._V_[0];
@@ -3457,7 +3465,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
 {
     typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     _Eng __e;
     result_type _Vp[_Kp+1];
     __is >> __e;
@@ -3667,7 +3676,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const uniform_int_distribution<_IT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left);
+    typedef basic_ostream<_CharT, _Traits> _Ostream;
+    __os.flags(_Ostream::dec | _Ostream::left);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     return __os << __x.a() << __sp << __x.b();
@@ -3682,7 +3692,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __a;
     result_type __b;
     __is >> __a >> __b;
@@ -3788,8 +3799,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const uniform_real_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     return __os << __x.a() << __sp << __x.b();
@@ -3804,7 +3816,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __a;
     result_type __b;
     __is >> __a >> __b;
@@ -3899,8 +3912,9 @@ basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     return __os << __x.p();
@@ -3913,7 +3927,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
     typedef bernoulli_distribution _Eng;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     double __p;
     __is >> __p;
     if (!__is.fail())
@@ -4083,8 +4098,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const binomial_distribution<_IntType>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     return __os << __x.t() << __sp << __x.p();
@@ -4099,7 +4115,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __t;
     double __p;
     __is >> __t >> __p;
@@ -4201,8 +4218,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const exponential_distribution<_RealType>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     return __os << __x.lambda();
 }
 
@@ -4215,7 +4233,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __lambda;
     __is >> __lambda;
     if (!__is.fail())
@@ -4355,8 +4374,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const normal_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.mean() << __sp << __x.stddev() << __sp << __x._V_hot_;
@@ -4374,7 +4394,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __mean;
     result_type __stddev;
     result_type _Vp = 0;
@@ -4729,8 +4750,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const poisson_distribution<_IntType>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     return __os << __x.mean();
 }
 
@@ -4742,7 +4764,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef poisson_distribution<_IntType> _Eng;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     double __mean;
     __is >> __mean;
     if (!__is.fail())
@@ -4840,8 +4863,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const weibull_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.a() << __sp << __x.b();
@@ -4857,7 +4881,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __a;
     result_type __b;
     __is >> __a >> __b;
@@ -4959,8 +4984,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const extreme_value_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.a() << __sp << __x.b();
@@ -4976,7 +5002,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __a;
     result_type __b;
     __is >> __a >> __b;
@@ -5131,8 +5158,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const gamma_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.alpha() << __sp << __x.beta();
@@ -5148,7 +5176,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __alpha;
     result_type __beta;
     __is >> __alpha >> __beta;
@@ -5267,8 +5296,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const negative_binomial_distribution<_IntType>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     return __os << __x.k() << __sp << __x.p();
@@ -5283,7 +5313,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __k;
     double __p;
     __is >> __k >> __p;
@@ -5373,8 +5404,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const geometric_distribution<_IntType>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     return __os << __x.p();
 }
 
@@ -5386,7 +5418,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef geometric_distribution<_IntType> _Eng;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     double __p;
     __is >> __p;
     if (!__is.fail())
@@ -5477,8 +5510,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const chi_squared_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     __os << __x.n();
     return __os;
 }
@@ -5492,7 +5526,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __n;
     __is >> __n;
     if (!__is.fail())
@@ -5597,8 +5632,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const cauchy_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.a() << __sp << __x.b();
@@ -5614,7 +5650,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __a;
     result_type __b;
     __is >> __a >> __b;
@@ -5719,8 +5756,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const fisher_f_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     __os << __x.m() << __sp << __x.n();
@@ -5736,7 +5774,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __m;
     result_type __n;
     __is >> __m >> __n;
@@ -5835,8 +5874,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const student_t_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     __os << __x.n();
     return __os;
 }
@@ -5850,7 +5890,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef typename _Eng::result_type result_type;
     typedef typename _Eng::param_type param_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     result_type __n;
     __is >> __n;
     if (!__is.fail())
@@ -6058,8 +6099,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const discrete_distribution<_IT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     size_t __n = __x.__p_.__p_.size();
@@ -6075,7 +6117,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
            discrete_distribution<_IT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     size_t __n;
     __is >> __n;
     vector<double> __p(__n);
@@ -6360,8 +6403,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const piecewise_constant_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     size_t __n = __x.__p_.__b_.size();
@@ -6387,7 +6431,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef piecewise_constant_distribution<_RT> _Eng;
     typedef typename _Eng::result_type result_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     size_t __n;
     __is >> __n;
     vector<result_type> __b(__n);
@@ -6700,8 +6745,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
            const piecewise_linear_distribution<_RT>& __x)
 {
     __save_flags<_CharT, _Traits> __lx(__os);
-    __os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
-               ios_base::scientific);
+    typedef basic_ostream<_CharT, _Traits> _OStream;
+    __os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
+               _OStream::scientific);
     _CharT __sp = __os.widen(' ');
     __os.fill(__sp);
     size_t __n = __x.__p_.__b_.size();
@@ -6727,7 +6773,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
     typedef piecewise_linear_distribution<_RT> _Eng;
     typedef typename _Eng::result_type result_type;
     __save_flags<_CharT, _Traits> __lx(__is);
-    __is.flags(ios_base::dec | ios_base::skipws);
+    typedef basic_istream<_CharT, _Traits> _Istream;
+    __is.flags(_Istream::dec | _Istream::skipws);
     size_t __n;
     __is >> __n;
     vector<result_type> __b(__n);


        


More information about the libcxx-commits mailing list