summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std
diff options
context:
space:
mode:
authorrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-09 20:58:24 +0000
committerrus <rus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-11-09 20:58:24 +0000
commit7f4db7c80779ecbc57d1146654daf0acfe18de66 (patch)
tree3af522a3b5e149c3fd498ecb1255994daae2129a /libstdc++-v3/include/std
parent611349f0ec42a37591db2cd02974a11a48d10edb (diff)
downloadgcc-profile-stdlib.tar.gz
merge from trunkprofile-stdlib
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/profile-stdlib@154052 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r--libstdc++-v3/include/std/chrono70
-rw-r--r--libstdc++-v3/include/std/future700
-rw-r--r--libstdc++-v3/include/std/iosfwd59
-rw-r--r--libstdc++-v3/include/std/limits16
-rw-r--r--libstdc++-v3/include/std/memory28
-rw-r--r--libstdc++-v3/include/std/ostream4
-rw-r--r--libstdc++-v3/include/std/random1
-rw-r--r--libstdc++-v3/include/std/sstream4
-rw-r--r--libstdc++-v3/include/std/streambuf28
-rw-r--r--libstdc++-v3/include/std/system_error4
-rw-r--r--libstdc++-v3/include/std/tuple3
-rw-r--r--libstdc++-v3/include/std/type_traits51
-rw-r--r--libstdc++-v3/include/std/utility16
13 files changed, 510 insertions, 474 deletions
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index aa4888d9a9d..e80ec13c093 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -138,9 +138,20 @@ namespace std
}
};
+ template<typename _Tp>
+ struct __is_duration
+ : std::false_type
+ { };
+
+ template<typename _Rep, typename _Period>
+ struct __is_duration<duration<_Rep, _Period>>
+ : std::true_type
+ { };
+
/// duration_cast
template<typename _ToDuration, typename _Rep, typename _Period>
- inline _ToDuration
+ inline typename enable_if<__is_duration<_ToDuration>::value,
+ _ToDuration>::type
duration_cast(const duration<_Rep, _Period>& __d)
{
typedef typename
@@ -175,16 +186,6 @@ namespace std
{ return numeric_limits<_Rep>::min(); }
};
- template<typename _Tp>
- struct __is_duration
- : std::false_type
- { };
-
- template<typename _Rep, typename _Period>
- struct __is_duration<duration<_Rep, _Period>>
- : std::true_type
- { };
-
template<typename T>
struct __is_ratio
: std::false_type
@@ -210,24 +211,19 @@ namespace std
// 20.8.3.1 construction / copy / destroy
duration() = default;
- template<typename _Rep2>
+ template<typename _Rep2, typename = typename
+ enable_if<is_convertible<_Rep2, rep>::value
+ && (treat_as_floating_point<rep>::value
+ || !treat_as_floating_point<_Rep2>::value)>::type>
explicit duration(const _Rep2& __rep)
- : __r(static_cast<rep>(__rep))
- {
- static_assert(is_convertible<_Rep2,rep>::value
- && (treat_as_floating_point<rep>::value
- || !treat_as_floating_point<_Rep2>::value),
- "cannot construct integral duration with floating point type");
- }
+ : __r(static_cast<rep>(__rep)) { }
- template<typename _Rep2, typename _Period2>
+ template<typename _Rep2, typename _Period2, typename = typename
+ enable_if<treat_as_floating_point<rep>::value
+ || (ratio_divide<_Period2, period>::type::den == 1
+ && !treat_as_floating_point<_Rep2>::value)>::type>
duration(const duration<_Rep2, _Period2>& __d)
- : __r(duration_cast<duration>(__d).count())
- {
- static_assert(treat_as_floating_point<rep>::value == true
- || ratio_divide<_Period2, period>::type::den == 1,
- "the resulting duration is not exactly representable");
- }
+ : __r(duration_cast<duration>(__d).count()) { }
~duration() = default;
duration(const duration&) = default;
@@ -358,8 +354,17 @@ namespace std
return __ct(__lhs) -= __rhs;
}
+ template<typename _Rep1, typename _Rep2, bool =
+ is_convertible<_Rep2,
+ typename common_type<_Rep1, _Rep2>::type>::value>
+ struct __common_rep_type { };
+
+ template<typename _Rep1, typename _Rep2>
+ struct __common_rep_type<_Rep1, _Rep2, true>
+ { typedef typename common_type<_Rep1, _Rep2>::type type; };
+
template<typename _Rep1, typename _Period, typename _Rep2>
- inline duration<typename common_type<_Rep1, _Rep2>::type, _Period>
+ inline duration<typename __common_rep_type<_Rep1, _Rep2>::type, _Period>
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type __cr;
@@ -367,12 +372,12 @@ namespace std
}
template<typename _Rep1, typename _Period, typename _Rep2>
- inline duration<typename common_type<_Rep1, _Rep2>::type, _Period>
- operator*(const _Rep2& __s, const duration<_Rep1, _Period>& __d)
+ inline duration<typename __common_rep_type<_Rep2, _Rep1>::type, _Period>
+ operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d)
{ return __d * __s; }
template<typename _Rep1, typename _Period, typename _Rep2>
- inline duration<typename common_type<_Rep1, typename
+ inline duration<typename __common_rep_type<_Rep1, typename
enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
@@ -393,7 +398,7 @@ namespace std
// DR 934.
template<typename _Rep1, typename _Period, typename _Rep2>
- inline duration<typename common_type<_Rep1, typename
+ inline duration<typename __common_rep_type<_Rep1, typename
enable_if<!__is_duration<_Rep2>::value, _Rep2>::type>::type, _Period>
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
@@ -540,7 +545,8 @@ namespace std
/// time_point_cast
template<typename _ToDuration, typename _Clock, typename _Duration>
- inline time_point<_Clock, _ToDuration>
+ inline typename enable_if<__is_duration<_ToDuration>::value,
+ time_point<_Clock, _ToDuration>>::type
time_point_cast(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>(
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index badb6e07e5a..b8c54b6075f 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -79,7 +79,7 @@ namespace std
*/
class future_error : public logic_error
{
- error_code _M_code;
+ error_code _M_code;
public:
explicit future_error(future_errc __ec)
@@ -96,250 +96,286 @@ namespace std
};
// Forward declarations.
- template<typename _Result>
+ template<typename _Res>
class unique_future;
- template<typename _Result>
+ template<typename _Res>
class shared_future;
template<typename>
class packaged_task;
- template<typename _Result>
+ template<typename _Res>
class promise;
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4)
- // Holds the result of a future
- struct _Future_result_base
+ /// Base class and enclosing scope.
+ struct __future_base
{
- _Future_result_base() = default;
- _Future_result_base(const _Future_result_base&) = delete;
- _Future_result_base& operator=(const _Future_result_base&) = delete;
+ /// Base class for results.
+ struct _Result_base
+ {
+ exception_ptr _M_error;
- exception_ptr _M_error;
+ _Result_base() = default;
+ _Result_base(const _Result_base&) = delete;
+ _Result_base& operator=(const _Result_base&) = delete;
- // _M_destroy() allows derived classes to control deallocation,
- // which will be needed when allocator support is added to promise.
- // See http://gcc.gnu.org/ml/libstdc++/2009-06/msg00032.html
- virtual void _M_destroy() = 0;
- struct _Deleter
- {
- void operator()(_Future_result_base* __fr) const { __fr->_M_destroy(); }
- };
+ // _M_destroy() allows derived classes to control deallocation,
+ // which will be needed when allocator support is added to promise.
+ // See http://gcc.gnu.org/ml/libstdc++/2009-06/msg00032.html
+ virtual void _M_destroy() = 0;
- protected:
- ~_Future_result_base() = default;
- };
+ struct _Deleter
+ {
+ void operator()(_Result_base* __fr) const { __fr->_M_destroy(); }
+ };
- // TODO: use template alias when available
- /*
- template<typename _Res>
- using _Future_ptr = unique_ptr<_Res, _Future_result_base::_Deleter>;
- */
- template<typename _Res>
- struct _Future_ptr
- {
- typedef unique_ptr<_Res, _Future_result_base::_Deleter> type;
+ protected:
+ ~_Result_base();
};
- // State shared between a promise and one or more associated futures.
- class _Future_state
- {
- typedef _Future_ptr<_Future_result_base>::type _Future_ptr_type;
+ /// Result.
+ template<typename _Res>
+ struct _Result : _Result_base
+ {
+ private:
+ typedef alignment_of<_Res> __a_of;
+ typedef aligned_storage<sizeof(_Res), __a_of::value> __align_storage;
+ typedef typename __align_storage::type __align_type;
+
+ __align_type _M_storage;
+ bool _M_initialized;
+
+ public:
+ _Result() : _M_initialized() { }
+
+ ~_Result()
+ {
+ if (_M_initialized)
+ _M_value().~_Res();
+ }
+
+ // Return lvalue, future will add const or rvalue-reference
+ _Res&
+ _M_value() { return *static_cast<_Res*>(_M_addr()); }
+
+ void
+ _M_set(const _Res& __res)
+ {
+ ::new (_M_addr()) _Res(__res);
+ _M_initialized = true;
+ }
+
+ void
+ _M_set(_Res&& __res)
+ {
+ ::new (_M_addr()) _Res(_Move_result<_Res>::_S_move(__res));
+ _M_initialized = true;
+ }
+
+ private:
+ void _M_destroy() { delete this; }
+
+ void* _M_addr() { return static_cast<void*>(&_M_storage); }
+ };
- public:
- _Future_state() : _M_result(), _M_retrieved(false) { }
- _Future_state(const _Future_state&) = delete;
- _Future_state& operator=(const _Future_state&) = delete;
+ /// Workaround for CWG issue 664 and c++/34022
+ template<typename _Res, bool = is_scalar<_Res>::value>
+ struct _Move_result;
- bool
- is_ready()
- { return _M_get() != 0; }
+ /// Specialization for scalar types returns rvalue not rvalue-reference.
+ template<typename _Res>
+ struct _Move_result<_Res, true>
+ {
+ typedef _Res __rval_type;
+ static _Res _S_move(_Res __res) { return __res; }
+ };
+
+ /// Specialization for non-scalar types returns rvalue-reference.
+ template<typename _Res>
+ struct _Move_result<_Res, false>
+ {
+ typedef _Res&& __rval_type;
+ static _Res&& _S_move(_Res& __res) { return std::move(__res); }
+ };
+
+
+ // TODO: use template alias when available
+ /*
+ template<typename _Res>
+ using _Ptr = unique_ptr<_Res, _Result_base::_Deleter>;
+ */
+ /// A unique_ptr based on the instantiating type.
+ template<typename _Res>
+ struct _Ptr
+ {
+ typedef unique_ptr<_Res, _Result_base::_Deleter> type;
+ };
- bool
- has_exception()
- {
- _Future_result_base* const __res = _M_get();
- return __res && !(__res->_M_error == 0);
- }
- bool
- has_value()
+ /// Shared state between a promise and one or more associated futures.
+ class _State
{
- _Future_result_base* const __res = _M_get();
- return __res && (__res->_M_error == 0);
- }
+ typedef _Ptr<_Result_base>::type _Ptr_type;
- _Future_result_base&
- wait()
- {
- unique_lock<mutex> __lock(_M_mutex);
- if (!_M_ready())
- _M_cond.wait(__lock, std::bind(&_Future_state::_M_ready, this));
- return *_M_result;
- }
+ _Ptr_type _M_result;
+ mutex _M_mutex;
+ condition_variable _M_cond;
+ atomic_flag _M_retrieved;
+
+ public:
+ _State() : _M_result(), _M_retrieved(ATOMIC_FLAG_INIT) { }
+
+ _State(const _State&) = delete;
+ _State& operator=(const _State&) = delete;
- template<typename _Rep, typename _Period>
bool
- wait_for(const chrono::duration<_Rep, _Period>& __rel)
- {
- unique_lock<mutex> __lock(_M_mutex);
- return _M_ready() || _M_cond.wait_for(__lock, __rel,
- std::bind(&_Future_state::_M_ready, this));
- }
+ is_ready()
+ { return _M_get() != 0; }
- template<typename _Clock, typename _Duration>
bool
- wait_until(const chrono::time_point<_Clock, _Duration>& __abs)
+ has_exception()
{
- unique_lock<mutex> __lock(_M_mutex);
- return _M_ready() || _M_cond.wait_until(__lock, __abs,
- std::bind(&_Future_state::_M_ready, this));
+ _Result_base* const __res = _M_get();
+ return __res && !(__res->_M_error == 0);
}
- void
- _M_set_result(_Future_ptr_type __res)
- {
+ bool
+ has_value()
{
- lock_guard<mutex> __lock(_M_mutex);
- if (_M_ready())
- __throw_future_error(int(future_errc::promise_already_satisfied));
- _M_result.swap(__res);
+ _Result_base* const __res = _M_get();
+ return __res && (__res->_M_error == 0);
}
- _M_cond.notify_all();
- }
- void
- _M_break_promise(_Future_ptr_type __res)
- {
- if (static_cast<bool>(__res))
+ _Result_base&
+ wait()
{
- __res->_M_error
- = std::copy_exception(future_error(future_errc::broken_promise));
- {
- lock_guard<mutex> __lock(_M_mutex);
- _M_result.swap(__res);
- }
- _M_cond.notify_all();
+ unique_lock<mutex> __lock(_M_mutex);
+ if (!_M_ready())
+ _M_cond.wait(__lock, std::bind(&_State::_M_ready, this));
+ return *_M_result;
}
- }
- // called when this object is passed to a unique_future
- void
- _M_set_retrieved_flag()
- {
- if (_M_retrieved.test_and_set())
- __throw_future_error(int(future_errc::future_already_retrieved));
- }
-
- private:
- _Future_result_base*
- _M_get()
- {
- lock_guard<mutex> __lock(_M_mutex);
- return _M_result.get();
- }
-
- bool _M_ready() const { return static_cast<bool>(_M_result); }
-
- _Future_ptr_type _M_result;
- mutex _M_mutex;
- condition_variable _M_cond;
- atomic_flag _M_retrieved;
- };
-
- // workaround for CWG issue 664 and c++/34022
- template<typename _Result, bool = is_scalar<_Result>::value>
- struct _Move_future_result
- {
- typedef _Result&& __rval_type;
- static _Result&& _S_move(_Result& __res) { return std::move(__res); }
- };
-
- // specialization for scalar types returns rvalue not rvalue-reference
- template<typename _Result>
- struct _Move_future_result<_Result, true>
- {
- typedef _Result __rval_type;
- static _Result _S_move(_Result __res) { return __res; }
- };
+ template<typename _Rep, typename _Period>
+ bool
+ wait_for(const chrono::duration<_Rep, _Period>& __rel)
+ {
+ unique_lock<mutex> __lock(_M_mutex);
+ auto __bound = std::bind(&_State::_M_ready, this);
+ return _M_ready() || _M_cond.wait_for(__lock, __rel, __bound);
+ }
- template<typename _Result>
- struct _Future_result : _Future_result_base
- {
- _Future_result() : _M_initialized() { }
+ template<typename _Clock, typename _Duration>
+ bool
+ wait_until(const chrono::time_point<_Clock, _Duration>& __abs)
+ {
+ unique_lock<mutex> __lock(_M_mutex);
+ auto __bound = std::bind(&_State::_M_ready, this);
+ return _M_ready() || _M_cond.wait_until(__lock, __abs, __bound);
+ }
- ~_Future_result()
+ void
+ _M_set_result(_Ptr_type __res)
{
- if (_M_initialized)
- _M_value().~_Result();
+ {
+ lock_guard<mutex> __lock(_M_mutex);
+ if (_M_ready())
+ __throw_future_error(int(future_errc::promise_already_satisfied));
+ _M_result.swap(__res);
+ }
+ _M_cond.notify_all();
}
- // return lvalue, future will add const or rvalue-reference
- _Result& _M_value()
- { return *static_cast<_Result*>(_M_addr()); }
-
void
- _M_set(const _Result& __res)
+ _M_break_promise(_Ptr_type __res)
{
- ::new (_M_addr()) _Result(__res);
- _M_initialized = true;
+ if (static_cast<bool>(__res))
+ {
+ future_errc __ec(future_errc::broken_promise); // XXX
+ __res->_M_error = copy_exception(future_error(__ec));
+ {
+ lock_guard<mutex> __lock(_M_mutex);
+ _M_result.swap(__res);
+ }
+ _M_cond.notify_all();
+ }
}
+ // Called when this object is passed to a unique_future.
void
- _M_set(_Result&& __res)
+ _M_set_retrieved_flag()
{
- typedef _Move_future_result<_Result> _Mover;
- ::new (_M_addr()) _Result(_Mover::_S_move(__res));
- _M_initialized = true;
+ if (_M_retrieved.test_and_set())
+ __throw_future_error(int(future_errc::future_already_retrieved));
}
private:
- void _M_destroy() { delete this; }
-
- void* _M_addr() { return static_cast<void*>(&_M_storage); }
+ _Result_base*
+ _M_get()
+ {
+ lock_guard<mutex> __lock(_M_mutex);
+ return _M_result.get();
+ }
- typename aligned_storage<sizeof(_Result),
- alignment_of<_Result>::value>::type _M_storage;
- bool _M_initialized;
+ bool _M_ready() const { return static_cast<bool>(_M_result); }
};
+ };
- template<typename _Result>
- struct _Future_result<_Result&> : _Future_result_base
- {
- _Future_result() : _M_value_ptr() { }
+ inline __future_base::_Result_base::~_Result_base() = default;
- _Result* _M_value_ptr;
+ /// Partial specialization for reference types.
+ template<typename _Res>
+ struct __future_base::_Result<_Res&> : __future_base::_Result_base
+ {
+ _Result() : _M_value_ptr() { }
+ _Res* _M_value_ptr;
+
+ private:
void _M_destroy() { delete this; }
};
+ /// Explicit specialization for void.
template<>
- struct _Future_result<void> : _Future_result_base
+ struct __future_base::_Result<void> : __future_base::_Result_base
{
+ private:
void _M_destroy() { delete this; }
};
- // common implementation for unique_future and shared_future
- template<typename _Result>
- class _Future_impl
+
+ /// Common implementation for unique_future and shared_future.
+ template<typename _Res>
+ class __basic_future : public __future_base
{
+ protected:
+ typedef shared_ptr<_State> __state_type;
+ typedef __future_base::_Result<_Res>& __result_type;
+
+ private:
+ __state_type _M_state;
+
public:
- // disable copying
- _Future_impl(const _Future_impl&) = delete;
- _Future_impl& operator=(const _Future_impl&) = delete;
+ // Disable copying.
+ __basic_future(const __basic_future&) = delete;
+ __basic_future& operator=(const __basic_future&) = delete;
- // functions to check state and wait for ready
- bool is_ready() const { return this->_M_state->is_ready(); }
+ // Functions to check state and wait for ready.
+ bool
+ is_ready() const { return this->_M_state->is_ready(); }
- bool has_exception() const { return this->_M_state->has_exception(); }
+ bool
+ has_exception() const { return this->_M_state->has_exception(); }
- bool has_value() const { return this->_M_state->has_value(); }
+ bool
+ has_value() const { return this->_M_state->has_value(); }
- void wait() const { this->_M_state->wait(); }
+ void
+ wait() const { this->_M_state->wait(); }
template<typename _Rep, typename _Period>
bool
@@ -352,22 +388,19 @@ namespace std
{ return this->_M_state->wait_until(__abs); }
protected:
- // wait for the state to be ready and rethrow any stored exception
- _Future_result<_Result>&
+ /// Wait for the state to be ready and rethrow any stored exception
+ __result_type
_M_get_result()
{
- _Future_result_base& __res = this->_M_state->wait();
+ _Result_base& __res = this->_M_state->wait();
if (!(__res._M_error == 0))
rethrow_exception(__res._M_error);
- return static_cast<_Future_result<_Result>&>(__res);
+ return static_cast<__result_type>(__res);
}
- typedef shared_ptr<_Future_state> _State_ptr;
-
- // construction of a unique_future by promise::get_future()
+ // Construction of a unique_future by promise::get_future()
explicit
- _Future_impl(const _State_ptr& __state)
- : _M_state(__state)
+ __basic_future(const __state_type& __state) : _M_state(__state)
{
if (static_cast<bool>(this->_M_state))
this->_M_state->_M_set_retrieved_flag();
@@ -375,146 +408,149 @@ namespace std
__throw_future_error(int(future_errc::future_already_retrieved));
}
- // copy construction from a shared_future
+ // Copy construction from a shared_future
explicit
- _Future_impl(const shared_future<_Result>&);
+ __basic_future(const shared_future<_Res>&);
- // move construction from a unique_future
+ // Move construction from a unique_future
explicit
- _Future_impl(unique_future<_Result>&&);
-
- _State_ptr _M_state;
+ __basic_future(unique_future<_Res>&&);
};
- /// primary template for unique_future
- template<typename _Result>
- class unique_future : public _Future_impl<_Result>
+
+ /// Primary template for unique_future.
+ template<typename _Res>
+ class unique_future : public __basic_future<_Res>
{
- typedef _Move_future_result<_Result> _Mover;
+ friend class promise<_Res>;
+
+ typedef __basic_future<_Res> _Base_type;
+ typedef typename _Base_type::__state_type __state_type;
+ typedef __future_base::_Move_result<_Res> _Mover;
+
+ explicit
+ unique_future(const __state_type& __state) : _Base_type(__state) { }
public:
/// Move constructor
unique_future(unique_future&& __uf) : _Base_type(std::move(__uf)) { }
- // disable copying
+ // Disable copying
unique_future(const unique_future&) = delete;
unique_future& operator=(const unique_future&) = delete;
- // retrieving the value
+ /// Retrieving the value
typename _Mover::__rval_type
get()
{ return _Mover::_S_move(this->_M_get_result()._M_value()); }
-
- private:
- typedef _Future_impl<_Result> _Base_type;
- typedef typename _Base_type::_State_ptr _State_ptr;
-
- friend class promise<_Result>;
-
- explicit
- unique_future(const _State_ptr& __state) : _Base_type(__state) { }
};
- // partial specialization for unique_future<R&>
- template<typename _Result>
- class unique_future<_Result&> : public _Future_impl<_Result&>
+ /// Partial specialization for unique_future<R&>
+ template<typename _Res>
+ class unique_future<_Res&> : public __basic_future<_Res&>
{
+ friend class promise<_Res&>;
+
+ typedef __basic_future<_Res&> _Base_type;
+ typedef typename _Base_type::__state_type __state_type;
+
+ explicit
+ unique_future(const __state_type& __state) : _Base_type(__state) { }
+
public:
/// Move constructor
unique_future(unique_future&& __uf) : _Base_type(std::move(__uf)) { }
- // disable copying
+ // Disable copying
unique_future(const unique_future&) = delete;
unique_future& operator=(const unique_future&) = delete;
- // retrieving the value
- _Result& get() { return *this->_M_get_result()._M_value_ptr; }
+ /// Retrieving the value
+ _Res&
+ get() { return *this->_M_get_result()._M_value_ptr; }
+ };
- private:
- typedef _Future_impl<_Result&> _Base_type;
- typedef typename _Base_type::_State_ptr _State_ptr;
+ /// Explicit specialization for unique_future<void>
+ template<>
+ class unique_future<void> : public __basic_future<void>
+ {
+ friend class promise<void>;
- friend class promise<_Result&>;
+ typedef __basic_future<void> _Base_type;
+ typedef typename _Base_type::__state_type __state_type;
explicit
- unique_future(const _State_ptr& __state) : _Base_type(__state) { }
- };
+ unique_future(const __state_type& __state) : _Base_type(__state) { }
- // specialization for unique_future<void>
- template<>
- class unique_future<void> : public _Future_impl<void>
- {
public:
/// Move constructor
unique_future(unique_future&& __uf) : _Base_type(std::move(__uf)) { }
- // disable copying
+ // Disable copying
unique_future(const unique_future&) = delete;
unique_future& operator=(const unique_future&) = delete;
- // retrieving the value
- void get() { this->_M_get_result(); }
-
- private:
- typedef _Future_impl<void> _Base_type;
- typedef _Base_type::_State_ptr _State_ptr;
-
- friend class promise<void>;
-
- explicit
- unique_future(const _State_ptr& __state) : _Base_type(__state) { }
+ /// Retrieving the value
+ void
+ get() { this->_M_get_result(); }
};
- /// primary template for shared_future
- template<typename _Result>
- class shared_future : public _Future_impl<_Result>
+
+ /// Primary template for shared_future.
+ template<typename _Res>
+ class shared_future : public __basic_future<_Res>
{
+ typedef __basic_future<_Res> _Base_type;
+
public:
/// Copy constructor
shared_future(const shared_future& __sf) : _Base_type(__sf) { }
/// Construct from a unique_future rvalue
- shared_future(unique_future<_Result>&& __uf)
+ shared_future(unique_future<_Res>&& __uf)
: _Base_type(std::move(__uf))
{ }
shared_future& operator=(const shared_future&) = delete;
- // retrieving the value
- const _Result&
+ /// Retrieving the value
+ const _Res&
get()
- { return this->_M_get_result()._M_value(); }
-
- private:
- typedef _Future_impl<_Result> _Base_type;
+ {
+ typename _Base_type::__result_type __r = this->_M_get_result();
+ _Res& __rs(__r._M_value());
+ return __rs;
+ }
};
- // partial specialization for shared_future<R&>
- template<typename _Result>
- class shared_future<_Result&> : public _Future_impl<_Result&>
+ /// Partial specialization for shared_future<R&>
+ template<typename _Res>
+ class shared_future<_Res&> : public __basic_future<_Res&>
{
+ typedef __basic_future<_Res&> _Base_type;
+
public:
/// Copy constructor
shared_future(const shared_future& __sf) : _Base_type(__sf) { }
/// Construct from a unique_future rvalue
- shared_future(unique_future<_Result&>&& __uf)
+ shared_future(unique_future<_Res&>&& __uf)
: _Base_type(std::move(__uf))
{ }
shared_future& operator=(const shared_future&) = delete;
- // retrieving the value
- _Result& get() { return *this->_M_get_result()._M_value_ptr; }
-
- private:
- typedef _Future_impl<_Result&> _Base_type;
+ /// Retrieving the value
+ _Res&
+ get() { return *this->_M_get_result()._M_value_ptr; }
};
- // specialization for shared_future<void>
+ /// Explicit specialization for shared_future<void>
template<>
- class shared_future<void> : public _Future_impl<void>
+ class shared_future<void> : public __basic_future<void>
{
+ typedef __basic_future<void> _Base_type;
+
public:
/// Copy constructor
shared_future(const shared_future& __sf) : _Base_type(__sf) { }
@@ -526,33 +562,39 @@ namespace std
shared_future& operator=(const shared_future&) = delete;
- // retrieving the value
- void get() { this->_M_get_result(); }
-
- private:
- typedef _Future_impl<void> _Base_type;
+ // Retrieving the value
+ void
+ get() { this->_M_get_result(); }
};
- // now we can define the protected _Future_impl constructors
-
- template<typename _Result>
- _Future_impl<_Result>::_Future_impl(const shared_future<_Result>& __sf)
+ // Now we can define the protected __basic_future constructors.
+ template<typename _Res>
+ __basic_future<_Res>::__basic_future(const shared_future<_Res>& __sf)
: _M_state(__sf._M_state)
{ }
- template<typename _Result>
- _Future_impl<_Result>::_Future_impl(unique_future<_Result>&& __uf)
+ template<typename _Res>
+ __basic_future<_Res>::__basic_future(unique_future<_Res>&& __uf)
: _M_state(std::move(__uf._M_state))
{ }
- /// primary template for promise
- template<typename _Result>
+
+ /// Primary template for promise
+ template<typename _Res>
class promise
{
+ template<typename> friend class packaged_task;
+
+ typedef __future_base::_State _State;
+ typedef __future_base::_Move_result<_Res> _Mover;
+ typedef __future_base::_Result<_Res> result_type;
+
+ shared_ptr<_State> _M_future;
+ typename __future_base::_Ptr<result_type>::type _M_storage;
+
public:
promise()
- : _M_future(std::make_shared<_Future_state>()),
- _M_storage(new _Future_result<_Result>())
+ : _M_future(std::make_shared<_State>()), _M_storage(new result_type())
{ }
promise(promise&& __rhs)
@@ -577,7 +619,7 @@ namespace std
_M_future->_M_break_promise(std::move(_M_storage));
}
- // assignment
+ // Assignment
promise&
operator=(promise&& __rhs)
{
@@ -594,14 +636,14 @@ namespace std
_M_storage.swap(__rhs._M_storage);
}
- // retrieving the result
- unique_future<_Result>
+ // Retrieving the result
+ unique_future<_Res>
get_future()
- { return unique_future<_Result>(_M_future); }
+ { return unique_future<_Res>(_M_future); }
- // setting the result
+ // Setting the result
void
- set_value(const _Result& __r)
+ set_value(const _Res& __r)
{
if (!_M_satisfied())
_M_storage->_M_set(__r);
@@ -609,7 +651,7 @@ namespace std
}
void
- set_value(_Result&& __r)
+ set_value(_Res&& __r)
{
if (!_M_satisfied())
_M_storage->_M_set(_Mover::_S_move(__r));
@@ -625,26 +667,29 @@ namespace std
}
private:
- template<typename> friend class packaged_task;
- typedef _Move_future_result<_Result> _Mover;
bool _M_satisfied() { return !static_cast<bool>(_M_storage); }
- shared_ptr<_Future_state> _M_future;
- typename _Future_ptr<_Future_result<_Result>>::type _M_storage;
};
- // partial specialization for promise<R&>
- template<typename _Result>
- class promise<_Result&>
+ /// Partial specialization for promise<R&>
+ template<typename _Res>
+ class promise<_Res&>
{
+ template<typename> friend class packaged_task;
+ typedef __future_base::_State _State;
+
+ typedef __future_base::_Result<_Res&> result_type;
+
+ shared_ptr<_State> _M_future;
+ typename __future_base::_Ptr<result_type>::type _M_storage;
+
public:
promise()
- : _M_future(std::make_shared<_Future_state>()),
- _M_storage(new _Future_result<_Result&>())
+ : _M_future(std::make_shared<_State>()), _M_storage(new result_type())
{ }
promise(promise&& __rhs)
- : _M_future(std::move(__rhs._M_future)),
- _M_storage(std::move(__rhs._M_storage))
+ : _M_future(std::move(__rhs._M_future)),
+ _M_storage(std::move(__rhs._M_storage))
{ }
// TODO: requires allocator concepts
@@ -664,7 +709,7 @@ namespace std
_M_future->_M_break_promise(std::move(_M_storage));
}
- // assignment
+ // Assignment
promise&
operator=(promise&& __rhs)
{
@@ -681,14 +726,14 @@ namespace std
_M_storage.swap(__rhs._M_storage);
}
- // retrieving the result
- unique_future<_Result&>
+ // Retrieving the result
+ unique_future<_Res&>
get_future()
- { return unique_future<_Result&>(_M_future); }
+ { return unique_future<_Res&>(_M_future); }
- // setting the result
+ // Setting the result
void
- set_value(_Result& __r)
+ set_value(_Res& __r)
{
if (!_M_satisfied())
_M_storage->_M_value_ptr = &__r;
@@ -704,20 +749,24 @@ namespace std
}
private:
- template<typename> friend class packaged_task;
bool _M_satisfied() { return !static_cast<bool>(_M_storage); }
- shared_ptr<_Future_state> _M_future;
- typename _Future_ptr<_Future_result<_Result&>>::type _M_storage;
};
- // specialization for promise<void>
+ /// Explicit specialization for promise<void>
template<>
class promise<void>
{
+ template<typename> friend class packaged_task;
+ typedef __future_base::_State _State;
+ typedef __future_base::_Result<void> result_type;
+
+ shared_ptr<__future_base::_State> _M_future;
+ typename __future_base::_Ptr<result_type>::type _M_storage;
+
public:
promise()
- : _M_future(std::make_shared<_Future_state>()),
- _M_storage(new _Future_result<void>())
+ : _M_future(std::make_shared<_State>()),
+ _M_storage(new result_type())
{ }
promise(promise&& __rhs)
@@ -742,7 +791,7 @@ namespace std
_M_future->_M_break_promise(std::move(_M_storage));
}
- // assignment
+ // Assignment
promise&
operator=(promise&& __rhs)
{
@@ -759,12 +808,12 @@ namespace std
_M_storage.swap(__rhs._M_storage);
}
- // retrieving the result
+ // Retrieving the result
unique_future<void>
get_future()
{ return unique_future<void>(_M_future); }
- // setting the result
+ // Setting the result
void
set_value()
{
@@ -780,53 +829,54 @@ namespace std
}
private:
- template<typename> friend class packaged_task;
bool _M_satisfied() { return !static_cast<bool>(_M_storage); }
- shared_ptr<_Future_state> _M_future;
- _Future_ptr<_Future_result<void>>::type _M_storage;
};
// TODO: requires allocator concepts
/*
- template<typename _Result, class Alloc>
- concept_map UsesAllocator<promise<_Result>, Alloc>
+ template<typename _Res, class Alloc>
+ concept_map UsesAllocator<promise<_Res>, Alloc>
{
typedef Alloc allocator_type;
}
*/
-
- template<typename _Result, typename... _ArgTypes>
+ /// Primary template.
+ template<typename _Res, typename... _ArgTypes>
struct _Run_task
{
static void
- _S_run(promise<_Result>& __p, function<_Result(_ArgTypes...)>& __f,
- _ArgTypes... __args)
+ _S_run(promise<_Res>& __p, function<_Res(_ArgTypes...)>& __f,
+ _ArgTypes... __args)
{
__p.set_value(__f(std::forward<_ArgTypes>(__args)...));
}
};
- // specialization used by packaged_task<void(...)>
+ /// Specialization used by packaged_task<void(...)>
template<typename... _ArgTypes>
struct _Run_task<void, _ArgTypes...>
{
static void
_S_run(promise<void>& __p, function<void(_ArgTypes...)>& __f,
- _ArgTypes... __args)
+ _ArgTypes... __args)
{
__f(std::forward<_ArgTypes>(__args)...);
__p.set_value();
}
};
+
/// packaged_task
- template<typename _Result, typename... _ArgTypes>
- class packaged_task<_Result(_ArgTypes...)>
+ template<typename _Res, typename... _ArgTypes>
+ class packaged_task<_Res(_ArgTypes...)>
{
+ function<_Res(_ArgTypes...)> _M_task;
+ promise<_Res> _M_promise;
+
public:
- typedef _Result result_type;
+ typedef _Res result_type;
- // construction and destruction
+ // Construction and destruction
packaged_task() { }
template<typename _Fn>
@@ -838,7 +888,7 @@ namespace std
packaged_task(_Fn&& __fn) : _M_task(std::move(__fn)) { }
explicit
- packaged_task(_Result(*__fn)(_ArgTypes...)) : _M_task(__fn) { }
+ packaged_task(_Res(*__fn)(_ArgTypes...)) : _M_task(__fn) { }
// TODO: requires allocator concepts
/*
@@ -857,11 +907,11 @@ namespace std
~packaged_task() = default;
- // no copy
+ // No copy
packaged_task(packaged_task&) = delete;
packaged_task& operator=(packaged_task&) = delete;
- // move support
+ // Move support
packaged_task(packaged_task&& __other)
{ this->swap(__other); }
@@ -880,8 +930,8 @@ namespace std
explicit operator bool() const { return static_cast<bool>(_M_task); }
- // result retrieval
- unique_future<_Result>
+ // Result retrieval
+ unique_future<_Res>
get_future()
{
__try
@@ -898,7 +948,7 @@ namespace std
}
}
- // execution
+ // Execution
void
operator()(_ArgTypes... __args)
{
@@ -913,7 +963,7 @@ namespace std
__try
{
- _Run_task<_Result, _ArgTypes...>::_S_run(_M_promise, _M_task,
+ _Run_task<_Res, _ArgTypes...>::_S_run(_M_promise, _M_task,
std::forward<_ArgTypes>(__args)...);
}
__catch (...)
@@ -922,11 +972,7 @@ namespace std
}
}
- void reset() { promise<_Result>().swap(_M_promise); }
-
- private:
- function<_Result(_ArgTypes...)> _M_task;
- promise<_Result> _M_promise;
+ void reset() { promise<_Res>().swap(_M_promise); }
};
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd
index 9bba0ab6bfc..b3405d7f1d5 100644
--- a/libstdc++-v3/include/std/iosfwd
+++ b/libstdc++-v3/include/std/iosfwd
@@ -43,6 +43,36 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
+ /**
+ * @defgroup io I/O
+ *
+ * Nearly all of the I/O classes are parameterized on the type of
+ * characters they read and write. (The major exception is ios_base at
+ * the top of the hierarchy.) This is a change from pre-Standard
+ * streams, which were not templates.
+ *
+ * For ease of use and compatibility, all of the basic_* I/O-related
+ * classes are given typedef names for both of the builtin character
+ * widths (wide and narrow). The typedefs are the same as the
+ * pre-Standard names, for example:
+ *
+ * @code
+ * typedef basic_ifstream<char> ifstream;
+ * @endcode
+ *
+ * Because properly forward-declaring these classes can be difficult, you
+ * should not do it yourself. Instead, include the &lt;iosfwd&gt;
+ * header, which contains only declarations of all the I/O classes as
+ * well as the typedefs. Trying to forward-declare the typedefs
+ * themselves (e.g., "class ostream;") is not valid ISO C++.
+ *
+ * For more specific declarations, see
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html
+ *
+ * @{
+ */
+ class ios_base;
+
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_ios;
@@ -94,36 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// Not included. (??? Apparently no LWG number?)
- class ios_base;
- /**
- * @defgroup io I/O
- *
- * Nearly all of the I/O classes are parameterized on the type of
- * characters they read and write. (The major exception is ios_base at
- * the top of the hierarchy.) This is a change from pre-Standard
- * streams, which were not templates.
- *
- * For ease of use and compatibility, all of the basic_* I/O-related
- * classes are given typedef names for both of the builtin character
- * widths (wide and narrow). The typedefs are the same as the
- * pre-Standard names, for example:
- *
- * @code
- * typedef basic_ifstream<char> ifstream;
- * @endcode
- *
- * Because properly forward-declaring these classes can be difficult, you
- * should not do it yourself. Instead, include the &lt;iosfwd&gt;
- * header, which contains only declarations of all the I/O classes as
- * well as the typedefs. Trying to forward-declare the typedefs
- * themselves (e.g., "class ostream;") is not valid ISO C++.
- *
- * For more specific declarations, see
- * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html
- *
- * @{
- */
typedef basic_ios<char> ios; ///< @isiosfwd
typedef basic_streambuf<char> streambuf; ///< @isiosfwd
typedef basic_istream<char> istream; ///< @isiosfwd
diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits
index 41bf806d5eb..1f3f078d0f0 100644
--- a/libstdc++-v3/include/std/limits
+++ b/libstdc++-v3/include/std/limits
@@ -203,9 +203,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* Is this supposed to be "if the type is integral"?
*/
static const bool is_integer = false;
- /** True if the type uses an exact representation. "All integer types are
+ /** True if the type uses an exact representation. 'All integer types are
exact, but not all exact types are integer. For example, rational and
- fixed-exponent representations are exact but not integer."
+ fixed-exponent representations are exact but not integer.'
[18.2.1.2]/15 */
static const bool is_exact = false;
/** For integer types, specifies the base of the representation. For
@@ -229,23 +229,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/** True if the type has a representation for positive infinity. */
static const bool has_infinity = false;
/** True if the type has a representation for a quiet (non-signaling)
- "Not a Number." */
+ 'Not a Number.' */
static const bool has_quiet_NaN = false;
/** True if the type has a representation for a signaling
- "Not a Number." */
+ 'Not a Number.' */
static const bool has_signaling_NaN = false;
/** See std::float_denorm_style for more information. */
static const float_denorm_style has_denorm = denorm_absent;
- /** "True if loss of accuracy is detected as a denormalization loss,
- rather than as an inexact result." [18.2.1.2]/42 */
+ /** 'True if loss of accuracy is detected as a denormalization loss,
+ rather than as an inexact result.' [18.2.1.2]/42 */
static const bool has_denorm_loss = false;
/** True if-and-only-if the type adheres to the IEC 559 standard, also
known as IEEE 754. (Only makes sense for floating point types.) */
static const bool is_iec559 = false;
- /** "True if the set of values representable by the type is finite. All
+ /** 'True if the set of values representable by the type is finite. All
built-in types are bounded, this member would be false for arbitrary
- precision types." [18.2.1.2]/54 */
+ precision types.' [18.2.1.2]/54 */
static const bool is_bounded = false;
/** True if the type is @e modulo, that is, if it is possible to add two
positive numbers and have a result that wraps around to a third number
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 9defd487c60..3e7d4e8466b 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -46,6 +46,20 @@
#pragma GCC system_header
+/**
+ * @defgroup memory Memory
+ * @ingroup utilities
+ *
+ * Components for memory allocation, deallocation, and management.
+ */
+
+/**
+ * @defgroup pointer_abstractions Pointer Abstractions
+ * @ingroup memory
+ *
+ * Smart pointers, etc.
+ */
+
#include <bits/stl_algobase.h>
#include <bits/allocator.h>
#include <bits/stl_construct.h>
@@ -64,37 +78,29 @@
# include <ext/concurrence.h>
# include <bits/functexcept.h>
# include <bits/stl_function.h> // std::less
-# include <bits/unique_ptr.h>
-# include <debug/debug.h>
# include <type_traits>
# include <functional>
+# include <debug/debug.h>
+# include <bits/unique_ptr.h>
# if _GLIBCXX_DEPRECATED
# include <backward/auto_ptr.h>
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/boost_sp_counted_base.h>
-# include <bits/shared_ptr.h>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/boost_sp_counted_base.h>
-# include <bits/shared_ptr.h>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
+# include <bits/shared_ptr.h>
#else
# include <backward/auto_ptr.h>
#endif
-/**
- * @defgroup memory Memory
- * @ingroup utilities
- *
- * Components for memory allocation, deallocation, and management.
- */
-
#endif /* _GLIBCXX_MEMORY */
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 9fc693cb3c3..d6241ba39a2 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -533,8 +533,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*
* This manipulator is often mistakenly used when a simple newline is
* desired, leading to poor buffering performance. See
- * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for more
- * on this subject.
+ * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html
+ * for more on this subject.
*/
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
diff --git a/libstdc++-v3/include/std/random b/libstdc++-v3/include/std/random
index b57ef4925d6..72d3ceb7f43 100644
--- a/libstdc++-v3/include/std/random
+++ b/libstdc++-v3/include/std/random
@@ -43,7 +43,6 @@
#include <limits>
#include <ext/type_traits.h>
#include <ext/numeric_traits.h>
-#include <bits/concept_check.h>
#include <debug/debug.h>
#include <type_traits>
diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream
index f5e3191c4cd..0ebf506d0c7 100644
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -112,9 +112,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @brief Copying out the string buffer.
* @return A copy of one of the underlying sequences.
*
- * "If the buffer is only created in input mode, the underlying
+ * 'If the buffer is only created in input mode, the underlying
* character sequence is equal to the input sequence; otherwise, it
- * is equal to the output sequence." [27.7.1.2]/1
+ * is equal to the output sequence.' [27.7.1.2]/1
*/
__string_type
str() const
diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf
index 790be0ec4d4..7d6b8c789cb 100644
--- a/libstdc++-v3/include/std/streambuf
+++ b/libstdc++-v3/include/std/streambuf
@@ -341,7 +341,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @return The previous character, if possible.
*
* Similar to sungetc(), but @a c is pushed onto the stream instead
- * of "the previous character". If successful, the next character
+ * of 'the previous character.' If successful, the next character
* fetched from the input stream will be @a c.
*/
int_type
@@ -366,8 +366,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*
* If a putback position is available, this function decrements the
* input pointer and returns that character. Otherwise, calls and
- * returns pbackfail(). The effect is to "unget" the last character
- * "gotten".
+ * returns pbackfail(). The effect is to 'unget' the last character
+ * 'gotten.'
*/
int_type
sungetc()
@@ -541,10 +541,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @param loc A new locale.
*
* Translations done during I/O which depend on the current locale
- * are changed by this call. The standard adds, "Between invocations
+ * are changed by this call. The standard adds, 'Between invocations
* of this function a class derived from streambuf can safely cache
* results of calls to locale functions and to members of facets
- * so obtained."
+ * so obtained.'
*
* @note Base class version does nothing.
*/
@@ -608,18 +608,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* @return An estimate of the number of characters available in the
* input sequence, or -1.
*
- * "If it returns a positive value, then successive calls to
+ * 'If it returns a positive value, then successive calls to
* @c underflow() will not return @c traits::eof() until at least that
* number of characters have been supplied. If @c showmanyc()
- * returns -1, then calls to @c underflow() or @c uflow() will fail."
+ * returns -1, then calls to @c underflow() or @c uflow() will fail.'
* [27.5.2.4.3]/1
*
* @note Base class version does nothing, returns zero.
- * @note The standard adds that "the intention is not only that the
+ * @note The standard adds that 'the intention is not only that the
* calls [to underflow or uflow] will not return @c eof() but
- * that they will return "immediately".
- * @note The standard adds that "the morphemes of @c showmanyc are
- * "es-how-many-see", not "show-manic".
+ * that they will return immediately.'
+ * @note The standard adds that 'the morphemes of @c showmanyc are
+ * 'es-how-many-see', not 'show-manic'.'
*/
virtual streamsize
showmanyc() { return 0; }
@@ -646,7 +646,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*
* Informally, this function is called when the input buffer is
* exhausted (or does not exist, as buffering need not actually be
- * done). If a buffer exists, it is "refilled". In either case, the
+ * done). If a buffer exists, it is 'refilled'. In either case, the
* next available character is returned, or @c traits::eof() to
* indicate a null pending sequence.
*
@@ -690,7 +690,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @brief Tries to back up the input sequence.
* @param c The character to be inserted back into the sequence.
- * @return eof() on failure, "some other value" on success
+ * @return eof() on failure, 'some other value' on success
* @post The constraints of @c gptr(), @c eback(), and @c pptr()
* are the same as for @c underflow().
*
@@ -726,7 +726,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*
* Informally, this function is called when the output buffer is full
* (or does not exist, as buffering need not actually be done). If a
- * buffer exists, it is "consumed", with "some effect" on the
+ * buffer exists, it is 'consumed', with 'some effect' on the
* controlled sequence. (Typically, the buffer is written out to the
* sequence verbatim.) In either case, the character @a c is also
* written out, if @a c is not @c eof().
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index 7f462a20dff..864741129a9 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -64,7 +64,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
class error_category
{
protected:
- error_category() = default;
+ error_category();
public:
virtual ~error_category() { }
@@ -100,6 +100,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return this != &__other; }
};
+ inline error_category::error_category() = default;
+
// DR 890.
_GLIBCXX_CONST const error_category& system_category() throw ();
_GLIBCXX_CONST const error_category& generic_category() throw ();
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 18cd89bca3b..1c46852a8fa 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -174,8 +174,7 @@ namespace std
template<typename... _UElements>
_Tuple_impl(_Tuple_impl<_Idx, _UElements...>&& __in)
: _Inherited(std::move(__in._M_tail())),
- _Base(std::forward<typename _Tuple_impl<_Idx, _UElements...>::
- _Base>(__in._M_head())) { }
+ _Base(std::move(__in._M_head())) { }
_Tuple_impl&
operator=(const _Tuple_impl& __in)
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index dd26bb84dbf..788edf66cff 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -57,7 +57,8 @@
namespace std
{
- /** @addtogroup metaprogramming
+ /**
+ * @addtogroup metaprogramming
* @{
*/
@@ -154,7 +155,7 @@ namespace std
template<typename _Tp>
struct __is_signed_helper<_Tp, true, false>
- : public integral_constant<bool, _Tp(-1) < _Tp(0)>
+ : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))>
{ };
/// is_signed
@@ -240,52 +241,28 @@ namespace std
{ };
// Relationships between types.
+ template<typename _From, typename _To,
+ bool = (is_void<_From>::value || is_void<_To>::value
+ || is_function<_To>::value || is_array<_To>::value)>
+ struct __is_convertible_helper
+ { static const bool __value = (is_void<_From>::value
+ && is_void<_To>::value); };
+
template<typename _From, typename _To>
- struct __is_convertible_simple
+ struct __is_convertible_helper<_From, _To, false>
: public __sfinae_types
{
private:
static __one __test(_To);
static __two __test(...);
- static _From __makeFrom();
-
+ static typename add_rvalue_reference<_From>::type __makeFrom();
+
public:
static const bool __value = sizeof(__test(__makeFrom())) == 1;
};
- template<typename _Tp>
- struct __is_int_or_cref
- {
- typedef typename remove_reference<_Tp>::type __rr_Tp;
- static const bool __value = (is_integral<_Tp>::value
- || (is_integral<__rr_Tp>::value
- && is_const<__rr_Tp>::value
- && !is_volatile<__rr_Tp>::value));
- };
-
- template<typename _From, typename _To,
- bool = (is_void<_From>::value || is_void<_To>::value
- || is_function<_To>::value || is_array<_To>::value
- // This special case is here only to avoid warnings.
- || (is_floating_point<typename
- remove_reference<_From>::type>::value
- && __is_int_or_cref<_To>::__value))>
- struct __is_convertible_helper
- {
- // "An imaginary lvalue of type From...".
- static const bool __value = (__is_convertible_simple<typename
- add_lvalue_reference<_From>::type,
- _To>::__value);
- };
-
- template<typename _From, typename _To>
- struct __is_convertible_helper<_From, _To, true>
- { static const bool __value = (is_void<_To>::value
- || (__is_int_or_cref<_To>::__value
- && !is_void<_From>::value)); };
-
// XXX FIXME
- // The C++0x specifications are different, see N2255.
+ // The C++0x specifications require front-end support, see N2255.
/// is_convertible
template<typename _From, typename _To>
struct is_convertible
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 1a6d0b1b6b5..c3826eaca6b 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -58,6 +58,14 @@
#pragma GCC system_header
+/**
+ * @defgroup utilities Utilities
+ *
+ * Components deemed generally useful. Includes pair, tuple,
+ * forward/move helpers, ratio, function object, metaprogramming and
+ * type traits, time, date, and memory functions.
+ */
+
#include <bits/c++config.h>
#include <bits/stl_relops.h>
#include <bits/stl_pair.h>
@@ -83,12 +91,4 @@
# include <initializer_list>
#endif
-/**
- * @defgroup utilities Utilities
- *
- * Components deemed generally useful. Includes pair, tuple,
- * forward/move helpers, ratio, function object, metaprogramming and
- * type traits, time, date, and memory functions.
- */
-
#endif /* _GLIBCXX_UTILITY */