Commit 53dc5044 by Paolo Carlini Committed by Paolo Carlini

cinttypes: Remove, move contents to C++0x and TR1 headers.

2010-11-02  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/tr1_impl/cinttypes: Remove, move contents to C++0x
	and TR1 headers.
	* include/tr1_impl/cstdlib: Likewise.
	* include/tr1_impl/cstdio: Likewise.
	* include/tr1_impl/cctype: Likewise.
	* include/tr1_impl/boost_sp_counted_base.h: Likewise.
	* include/tr1_impl/cmath: Likewise.
	* include/tr1_impl/cfenv: Likewise.
	* include/tr1_impl/utility: Likewise.
	* include/tr1_impl/complex: Likewise.
	* include/tr1_impl/cwchar: Likewise.
	* include/tr1_impl/type_traits: Likewise.
	* include/tr1_impl/cstdint: Likewise.
	* include/tr1_impl/regex: Likewise.
	* include/tr1_impl/array: Likewise.
	* include/tr1_impl/cwctype: Likewise.
	* include/Makefile.am: Adjust.
	* include/Makefile.in: Regenerate.
	* src/condition_variable.cc: Adjust; consistently use
	_GLIBCXX_BEGIN_NAMESPACE and _GLIBCXX_END_NAMESPACE.
	* src/mutex.cc: Likewise.
	* src/future.cc: Likewise.
	* src/atomic.cc: Likewise.
	* src/chrono.cc: Likewise.
	* src/thread.cc: Likewise.
	* include/std/tuple: Likewise.
	* include/std/utility: Likewise.
	* include/std/thread: Likewise.: Likewise.
	* include/std/type_traits: Likewise.
	* include/std/memory: Likewise.
	* include/std/future: Likewise.
	* include/std/ratio: Likewise.
	* include/std/chrono: Likewise.
	* include/std/condition_variable: Likewise.
	* include/std/mutex: Likewise.
	* include/std/functional: Likewise.
	* include/std/complex: Likewise.
	* include/std/typeindex: Likewise.
	* include/std/array: Likewise.
	* include/bits/regex_compiler.h: Likewise.
	* include/bits/regex_grep_matcher.tcc: Likewise.
	* include/bits/regex_grep_matcher.h: Likewise.
	* include/bits/regex_constants.h: Likewise.
	* include/bits/regex_cursor.h: Likewise.
	* include/bits/regex_nfa.tcc: Likewise.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/bits/regex_nfa.h: Likewise.
	* include/bits/random.tcc: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/random.h: Likewise.
	* include/bits/regex_error.h: Likewise.
	* include/c_global/cinttypes: Likewise.
	* include/c_global/cstdlib: Likewise.
	* include/c_global/cstdio: Likewise.
	* include/c_global/cctype: Likewise.
	* include/c_global/cmath: Likewise.
	* include/c_global/cfenv: Likewise.
	* include/c_global/cwchar: Likewise.
	* include/c_global/cstdint: Likewise.
	* include/c_global/cwctype: Likewise.
	* include/tr1/shared_ptr.h: Likewise.
	* include/tr1/cinttypes: Likewise.
	* include/tr1/cstdio: Likewise.
	* include/tr1/cfenv: Likewise.
	* include/tr1/utility: Likewise.
	* include/tr1/cwchar: Likewise.
	* include/tr1/type_traits: Likewise.
	* include/tr1/memory: Likewise.
	* include/tr1/cstdint: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr1/cwctype: Likewise.
	* include/tr1/cstdlib: Likewise.
	* include/tr1/cctype: Likewise.
	* include/tr1/cmath: Likewise.
	* include/tr1/complex: Likewise.
	* include/tr1/array: Likewise.
	* include/c_compatibility/fenv.h: Likewise.
	* include/c_compatibility/stdint.h: Likewise.
	* include/c_compatibility/inttypes.h: Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc: Adjust
	dg-error line numbers.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
	* testsuite/20_util/make_unsigned/requirements/
	typedefs_neg.cc: Likewise.
	* testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/43820.cc: Likewise.
	* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.

From-SVN: r166211
parent a9992f7f
2010-11-02 Paolo Carlini <paolo.carlini@oracle.com>
* include/tr1_impl/cinttypes: Remove, move contents to C++0x
and TR1 headers.
* include/tr1_impl/cstdlib: Likewise.
* include/tr1_impl/cstdio: Likewise.
* include/tr1_impl/cctype: Likewise.
* include/tr1_impl/boost_sp_counted_base.h: Likewise.
* include/tr1_impl/cmath: Likewise.
* include/tr1_impl/cfenv: Likewise.
* include/tr1_impl/utility: Likewise.
* include/tr1_impl/complex: Likewise.
* include/tr1_impl/cwchar: Likewise.
* include/tr1_impl/type_traits: Likewise.
* include/tr1_impl/cstdint: Likewise.
* include/tr1_impl/regex: Likewise.
* include/tr1_impl/array: Likewise.
* include/tr1_impl/cwctype: Likewise.
* include/Makefile.am: Adjust.
* include/Makefile.in: Regenerate.
* src/condition_variable.cc: Adjust; consistently use
_GLIBCXX_BEGIN_NAMESPACE and _GLIBCXX_END_NAMESPACE.
* src/mutex.cc: Likewise.
* src/future.cc: Likewise.
* src/atomic.cc: Likewise.
* src/chrono.cc: Likewise.
* src/thread.cc: Likewise.
* include/std/tuple: Likewise.
* include/std/utility: Likewise.
* include/std/thread: Likewise.: Likewise.
* include/std/type_traits: Likewise.
* include/std/memory: Likewise.
* include/std/future: Likewise.
* include/std/ratio: Likewise.
* include/std/chrono: Likewise.
* include/std/condition_variable: Likewise.
* include/std/mutex: Likewise.
* include/std/functional: Likewise.
* include/std/complex: Likewise.
* include/std/typeindex: Likewise.
* include/std/array: Likewise.
* include/bits/regex_compiler.h: Likewise.
* include/bits/regex_grep_matcher.tcc: Likewise.
* include/bits/regex_grep_matcher.h: Likewise.
* include/bits/regex_constants.h: Likewise.
* include/bits/regex_cursor.h: Likewise.
* include/bits/regex_nfa.tcc: Likewise.
* include/bits/shared_ptr_base.h: Likewise.
* include/bits/regex_nfa.h: Likewise.
* include/bits/random.tcc: Likewise.
* include/bits/regex.h: Likewise.
* include/bits/random.h: Likewise.
* include/bits/regex_error.h: Likewise.
* include/c_global/cinttypes: Likewise.
* include/c_global/cstdlib: Likewise.
* include/c_global/cstdio: Likewise.
* include/c_global/cctype: Likewise.
* include/c_global/cmath: Likewise.
* include/c_global/cfenv: Likewise.
* include/c_global/cwchar: Likewise.
* include/c_global/cstdint: Likewise.
* include/c_global/cwctype: Likewise.
* include/tr1/shared_ptr.h: Likewise.
* include/tr1/cinttypes: Likewise.
* include/tr1/cstdio: Likewise.
* include/tr1/cfenv: Likewise.
* include/tr1/utility: Likewise.
* include/tr1/cwchar: Likewise.
* include/tr1/type_traits: Likewise.
* include/tr1/memory: Likewise.
* include/tr1/cstdint: Likewise.
* include/tr1/regex: Likewise.
* include/tr1/cwctype: Likewise.
* include/tr1/cstdlib: Likewise.
* include/tr1/cctype: Likewise.
* include/tr1/cmath: Likewise.
* include/tr1/complex: Likewise.
* include/tr1/array: Likewise.
* include/c_compatibility/fenv.h: Likewise.
* include/c_compatibility/stdint.h: Likewise.
* include/c_compatibility/inttypes.h: Likewise.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820.cc: Adjust
dg-error line numbers.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise.
* testsuite/20_util/make_unsigned/requirements/
typedefs_neg.cc: Likewise.
* testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/cons/43820.cc: Likewise.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
2010-11-02 Paolo Carlini <paolo.carlini@oracle.com
* testsuite/28_regex/05_constants/syntax_option_type.cc: Avoid
......
......@@ -610,26 +610,6 @@ tr1_headers = \
${tr1_srcdir}/wchar.h \
${tr1_srcdir}/wctype.h
tr1_impl_srcdir = ${glibcxx_srcdir}/include/tr1_impl
tr1_impl_builddir = ./tr1_impl
tr1_impl_headers = \
${tr1_impl_srcdir}/array \
${tr1_impl_srcdir}/boost_sp_counted_base.h \
${tr1_impl_srcdir}/cctype \
${tr1_impl_srcdir}/cfenv \
${tr1_impl_srcdir}/cinttypes \
${tr1_impl_srcdir}/cmath \
${tr1_impl_srcdir}/complex \
${tr1_impl_srcdir}/cstdint \
${tr1_impl_srcdir}/cstdio \
${tr1_impl_srcdir}/cstdlib \
${tr1_impl_srcdir}/cwchar \
${tr1_impl_srcdir}/cwctype \
${tr1_impl_srcdir}/regex \
${tr1_impl_srcdir}/type_traits \
${tr1_impl_srcdir}/utility
decimal_srcdir = ${glibcxx_srcdir}/include/decimal
decimal_builddir = ./decimal
decimal_headers = \
......@@ -908,9 +888,9 @@ endif
# CLEANFILES and all-local are kept up-to-date.
allstamped = \
stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr1-impl \
stamp-decimal stamp-debug stamp-parallel stamp-profile \
stamp-profile-impl stamp-host
stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-decimal \
stamp-debug stamp-parallel stamp-profile stamp-profile-impl \
stamp-host
# List of all files that are created by explicit building, editing, or
# catenation.
......@@ -1019,11 +999,6 @@ stamp-tr1: ${tr1_headers}
@-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-tr1
stamp-tr1-impl: ${tr1_impl_headers}
@-mkdir -p ${tr1_impl_builddir}
@-cd ${tr1_impl_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-tr1-impl
stamp-decimal: ${decimal_headers}
@-mkdir -p ${decimal_builddir}
@-cd ${decimal_builddir} && $(LN_S) $? . 2>/dev/null
......@@ -1254,9 +1229,6 @@ install-headers:
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir}
for file in ${tr1_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}
for file in ${tr1_impl_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}; done
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${decimal_builddir}
for file in ${decimal_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${decimal_builddir}; done
......@@ -1303,11 +1275,10 @@ clean-local:
# developer tries to create them via make in the include build
# directory. (This is more of an example of how this kind of rule can
# be made.)
.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr1_impl_headers)
.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers)
$(decimal_headers) $(ext_headers)
$(std_headers): ; @:
$(c_base_headers): ; @:
$(tr1_headers): ; @:
$(tr1_impl_headers): ; @:
$(decimal_headers): ; @:
$(ext_headers): ; @:
......@@ -848,25 +848,6 @@ tr1_headers = \
${tr1_srcdir}/wchar.h \
${tr1_srcdir}/wctype.h
tr1_impl_srcdir = ${glibcxx_srcdir}/include/tr1_impl
tr1_impl_builddir = ./tr1_impl
tr1_impl_headers = \
${tr1_impl_srcdir}/array \
${tr1_impl_srcdir}/boost_sp_counted_base.h \
${tr1_impl_srcdir}/cctype \
${tr1_impl_srcdir}/cfenv \
${tr1_impl_srcdir}/cinttypes \
${tr1_impl_srcdir}/cmath \
${tr1_impl_srcdir}/complex \
${tr1_impl_srcdir}/cstdint \
${tr1_impl_srcdir}/cstdio \
${tr1_impl_srcdir}/cstdlib \
${tr1_impl_srcdir}/cwchar \
${tr1_impl_srcdir}/cwctype \
${tr1_impl_srcdir}/regex \
${tr1_impl_srcdir}/type_traits \
${tr1_impl_srcdir}/utility
decimal_srcdir = ${glibcxx_srcdir}/include/decimal
decimal_builddir = ./decimal
decimal_headers = \
......@@ -1133,9 +1114,9 @@ PCHFLAGS = -x c++-header -nostdinc++ $(CXXFLAGS)
# CLEANFILES and all-local are kept up-to-date.
allstamped = \
stamp-std stamp-bits stamp-c_base stamp-c_compatibility \
stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-tr1-impl \
stamp-decimal stamp-debug stamp-parallel stamp-profile \
stamp-profile-impl stamp-host
stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-decimal \
stamp-debug stamp-parallel stamp-profile stamp-profile-impl \
stamp-host
# List of all files that are created by explicit building, editing, or
......@@ -1406,11 +1387,6 @@ stamp-tr1: ${tr1_headers}
@-cd ${tr1_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-tr1
stamp-tr1-impl: ${tr1_impl_headers}
@-mkdir -p ${tr1_impl_builddir}
@-cd ${tr1_impl_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-tr1-impl
stamp-decimal: ${decimal_headers}
@-mkdir -p ${decimal_builddir}
@-cd ${decimal_builddir} && $(LN_S) $? . 2>/dev/null
......@@ -1629,9 +1605,6 @@ install-headers:
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_builddir}
for file in ${tr1_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}
for file in ${tr1_impl_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_impl_builddir}; done
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${decimal_builddir}
for file in ${decimal_headers}; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${decimal_builddir}; done
......@@ -1675,12 +1648,11 @@ clean-local:
# developer tries to create them via make in the include build
# directory. (This is more of an example of how this kind of rule can
# be made.)
.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(tr1_impl_headers)
.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers)
$(decimal_headers) $(ext_headers)
$(std_headers): ; @:
$(c_base_headers): ; @:
$(tr1_headers): ; @:
$(tr1_impl_headers): ; @:
$(decimal_headers): ; @:
$(ext_headers): ; @:
......
......@@ -33,8 +33,8 @@
#include <vector>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
// [26.4] Random number generation
/**
......@@ -5376,6 +5376,6 @@ namespace std
/* @} */ // group random_utilities
/* @} */ // group random
}
_GLIBCXX_END_NAMESPACE
#endif
......@@ -32,8 +32,8 @@
#include <numeric> // std::accumulate and std::partial_sum
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/*
* (Further) implementation-space details.
*/
......@@ -2818,6 +2818,6 @@ namespace std
}
return __sum / __tmp;
}
}
_GLIBCXX_END_NAMESPACE
#endif
......@@ -28,8 +28,7 @@
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @defgroup regex Regular Expressions
......@@ -2422,6 +2421,5 @@ namespace std
#endif
//@} // group regex
}
_GLIBCXX_END_NAMESPACE
......@@ -28,8 +28,8 @@
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace __regex
{
struct _Scanner_base
......@@ -1110,6 +1110,7 @@ namespace __regex
__f)._M_nfa())); }
} // namespace __regex
} // namespace std
_GLIBCXX_END_NAMESPACE
/* vim: set ts=8 sw=2 sts=2: */
......@@ -30,8 +30,7 @@
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @namespace std::regex_constants
......@@ -295,5 +294,6 @@ namespace regex_constants
//@}
} // namespace regex_constants
} // namespace std
_GLIBCXX_END_NAMESPACE
......@@ -28,8 +28,8 @@
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace __regex
{
// ABC for pattern matching
......@@ -87,6 +87,5 @@ namespace __regex
{ return _SpecializedCursor<_FwdIterT>(__b, __e); }
} // namespace __regex
} // namespace std
/* vim: set ts=8 sw=2 sts=2: */
_GLIBCXX_END_NAMESPACE
......@@ -30,8 +30,7 @@
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace regex_constants
{
......@@ -156,5 +155,4 @@ namespace regex_constants
__throw_regex_error(regex_constants::error_type __ecode)
{ throw regex_error(__ecode); }
} // namespace std
_GLIBCXX_END_NAMESPACE
......@@ -28,9 +28,8 @@
* You should not attempt to use it directly.
*/
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace std
{
template<typename _BiIter>
class sub_match;
......@@ -124,8 +123,7 @@ namespace __regex
};
} // namespace __regex
} // namespace std
#include <bits/regex_grep_matcher.tcc>
_GLIBCXX_END_NAMESPACE
/* vim: set ts=8 sw=2 sts=2: */
#include <bits/regex_grep_matcher.tcc>
......@@ -25,10 +25,10 @@
/**
* @file bits/regex_grep_matcher.tcc
*/
#include <regex>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace
{
......@@ -172,6 +172,5 @@ namespace __regex
}
} // namespace __regex
} // namespace std
/* vim: set ts=8 sw=2 sts=2: */
_GLIBCXX_END_NAMESPACE
......@@ -28,8 +28,8 @@
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace __regex
{
......@@ -397,7 +397,8 @@ namespace __regex
};
} // namespace __regex
} // namespace std
_GLIBCXX_END_NAMESPACE
#include <bits/regex_nfa.tcc>
......@@ -27,8 +27,8 @@
*/
#include <regex>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace __regex
{
#ifdef _GLIBCXX_DEBUG
......@@ -166,5 +166,5 @@ _M_clone()
{ return 0; }
} // namespace __regex
} // namespace std
_GLIBCXX_END_NAMESPACE
......@@ -51,6 +51,202 @@
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @brief Exception possibly thrown by @c shared_ptr.
* @ingroup exceptions
*/
class bad_weak_ptr : public std::exception
{
public:
virtual char const*
what() const throw()
{ return "std::bad_weak_ptr"; }
};
// Substitute for bad_weak_ptr object in the case of -fno-exceptions.
inline void
__throw_bad_weak_ptr()
{
#if __EXCEPTIONS
throw bad_weak_ptr();
#else
__builtin_abort();
#endif
}
using __gnu_cxx::_Lock_policy;
using __gnu_cxx::__default_lock_policy;
using __gnu_cxx::_S_single;
using __gnu_cxx::_S_mutex;
using __gnu_cxx::_S_atomic;
// Empty helper class except when the template argument is _S_mutex.
template<_Lock_policy _Lp>
class _Mutex_base
{
protected:
// The atomic policy uses fully-fenced builtins, single doesn't care.
enum { _S_need_barriers = 0 };
};
template<>
class _Mutex_base<_S_mutex>
: public __gnu_cxx::__mutex
{
protected:
// This policy is used when atomic builtins are not available.
// The replacement atomic operations might not have the necessary
// memory barriers.
enum { _S_need_barriers = 1 };
};
template<_Lock_policy _Lp = __default_lock_policy>
class _Sp_counted_base
: public _Mutex_base<_Lp>
{
public:
_Sp_counted_base()
: _M_use_count(1), _M_weak_count(1) { }
virtual
~_Sp_counted_base() // nothrow
{ }
// Called when _M_use_count drops to zero, to release the resources
// managed by *this.
virtual void
_M_dispose() = 0; // nothrow
// Called when _M_weak_count drops to zero.
virtual void
_M_destroy() // nothrow
{ delete this; }
virtual void*
_M_get_deleter(const std::type_info&) = 0;
void
_M_add_ref_copy()
{ __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
void
_M_add_ref_lock();
void
_M_release() // nothrow
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
_M_dispose();
// There must be a memory barrier between dispose() and destroy()
// to ensure that the effects of dispose() are observed in the
// thread that runs destroy().
// See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html
if (_Mutex_base<_Lp>::_S_need_barriers)
{
_GLIBCXX_READ_MEM_BARRIER;
_GLIBCXX_WRITE_MEM_BARRIER;
}
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
-1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
_M_destroy();
}
}
}
void
_M_weak_add_ref() // nothrow
{ __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
void
_M_weak_release() // nothrow
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
if (_Mutex_base<_Lp>::_S_need_barriers)
{
// See _M_release(),
// destroy() must observe results of dispose()
_GLIBCXX_READ_MEM_BARRIER;
_GLIBCXX_WRITE_MEM_BARRIER;
}
_M_destroy();
}
}
long
_M_get_use_count() const // nothrow
{
// No memory barrier is used here so there is no synchronization
// with other threads.
return const_cast<const volatile _Atomic_word&>(_M_use_count);
}
private:
_Sp_counted_base(_Sp_counted_base const&);
_Sp_counted_base& operator=(_Sp_counted_base const&);
_Atomic_word _M_use_count; // #shared
_Atomic_word _M_weak_count; // #weak + (#shared != 0)
};
template<>
inline void
_Sp_counted_base<_S_single>::
_M_add_ref_lock()
{
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
template<>
inline void
_Sp_counted_base<_S_mutex>::
_M_add_ref_lock()
{
__gnu_cxx::__scoped_lock sentry(*this);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
template<>
inline void
_Sp_counted_base<_S_atomic>::
_M_add_ref_lock()
{
// Perform lock-free add-if-not-zero operation.
_Atomic_word __count;
do
{
__count = _M_use_count;
if (__count == 0)
__throw_bad_weak_ptr();
// Replace the current counter value with the old value + 1, as
// long as it's not changed meanwhile.
}
while (!__sync_bool_compare_and_swap(&_M_use_count, __count,
__count + 1));
}
// Forward declarations.
template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
class __shared_ptr;
......
......@@ -37,22 +37,46 @@
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cfenv>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cfenv>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
#endif
#if _GLIBCXX_USE_C99_FENV_TR1
#undef feclearexcept
#undef fegetexceptflag
#undef feraiseexcept
#undef fesetexceptflag
#undef fetestexcept
#undef fegetround
#undef fesetround
#undef fegetenv
#undef feholdexcept
#undef fesetenv
#undef feupdateenv
_GLIBCXX_BEGIN_NAMESPACE(std)
// types
using ::fenv_t;
using ::fexcept_t;
// functions
using ::feclearexcept;
using ::fegetexceptflag;
using ::feraiseexcept;
using ::fesetexceptflag;
using ::fetestexcept;
using ::fegetround;
using ::fesetround;
using ::fegetenv;
using ::feholdexcept;
using ::fesetenv;
using ::feupdateenv;
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99_FENV_TR1
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_FENV_H
......@@ -48,22 +48,38 @@
# endif
# endif
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cinttypes>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cinttypes>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
_GLIBCXX_BEGIN_NAMESPACE(std)
// types
using ::imaxdiv_t;
// functions
using ::imaxabs;
// May collide with _Longlong abs(_Longlong), and is not described
// anywhere outside the synopsis. Likely, a defect.
//
// intmax_t abs(intmax_t)
using ::imaxdiv;
// Likewise, with lldiv_t div(_Longlong, _Longlong).
//
// imaxdiv_t div(intmax_t, intmax_t)
using ::strtoimax;
using ::strtoumax;
#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
using ::wcstoimax;
using ::wcstoumax;
#endif
_GLIBCXX_END_NAMESPACE
#endif _GLIBCXX_USE_C99_INTTYPES_TR1
#else
......
......@@ -56,22 +56,49 @@
# endif
# endif
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cstdint>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cstdint>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
_GLIBCXX_BEGIN_NAMESPACE(std)
using ::int8_t;
using ::int16_t;
using ::int32_t;
using ::int64_t;
using ::int_fast8_t;
using ::int_fast16_t;
using ::int_fast32_t;
using ::int_fast64_t;
using ::int_least8_t;
using ::int_least16_t;
using ::int_least32_t;
using ::int_least64_t;
using ::intmax_t;
using ::intptr_t;
using ::uint8_t;
using ::uint16_t;
using ::uint32_t;
using ::uint64_t;
using ::uint_fast8_t;
using ::uint_fast16_t;
using ::uint_fast32_t;
using ::uint_fast64_t;
using ::uint_least8_t;
using ::uint_least16_t;
using ::uint_least32_t;
using ::uint_least64_t;
using ::uintmax_t;
using ::uintptr_t;
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99_STDINT_TR1
#else
......
......@@ -80,22 +80,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cctype>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cctype>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
#endif
#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
#undef isblank
_GLIBCXX_BEGIN_NAMESPACE(std)
using ::isblank;
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99_CTYPE_TR1
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif
......@@ -33,29 +33,53 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
# include <bits/c++0x_warning.h>
#endif
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
#endif
#else
#include <bits/c++config.h>
#if _GLIBCXX_HAVE_FENV_H
# include <fenv.h>
#endif
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cfenv>
#else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cfenv>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
#endif
#ifdef _GLIBCXX_USE_C99_FENV_TR1
#undef feclearexcept
#undef fegetexceptflag
#undef feraiseexcept
#undef fesetexceptflag
#undef fetestexcept
#undef fegetround
#undef fesetround
#undef fegetenv
#undef feholdexcept
#undef fesetenv
#undef feupdateenv
_GLIBCXX_BEGIN_NAMESPACE(std)
// types
using ::fenv_t;
using ::fexcept_t;
// functions
using ::feclearexcept;
using ::fegetexceptflag;
using ::feraiseexcept;
using ::fesetexceptflag;
using ::fetestexcept;
using ::fegetround;
using ::fesetround;
using ::fegetenv;
using ::feholdexcept;
using ::fesetenv;
using ::feupdateenv;
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99_FENV_TR1
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_CFENV
......@@ -33,11 +33,7 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
# include <bits/c++0x_warning.h>
#endif
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
#endif
#else
#include <cstdint>
......@@ -54,18 +50,39 @@
# endif
#endif
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cinttypes>
#else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cinttypes>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
_GLIBCXX_BEGIN_NAMESPACE(std)
// types
using ::imaxdiv_t;
// functions
using ::imaxabs;
// May collide with _Longlong abs(_Longlong), and is not described
// anywhere outside the synopsis. Likely, a defect.
//
// intmax_t abs(intmax_t)
using ::imaxdiv;
// Likewise, with lldiv_t div(_Longlong, _Longlong).
//
// imaxdiv_t div(intmax_t, intmax_t)
using ::strtoimax;
using ::strtoumax;
#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
using ::wcstoimax;
using ::wcstoumax;
#endif
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99_INTTYPES_TR1
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_CINTTYPES
......@@ -33,11 +33,7 @@
#ifndef __GXX_EXPERIMENTAL_CXX0X__
# include <bits/c++0x_warning.h>
#endif
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
#endif
#else
#include <bits/c++config.h>
......@@ -62,18 +58,50 @@
# endif
#endif
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cstdint>
#else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cstdint>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
_GLIBCXX_BEGIN_NAMESPACE(std)
using ::int8_t;
using ::int16_t;
using ::int32_t;
using ::int64_t;
using ::int_fast8_t;
using ::int_fast16_t;
using ::int_fast32_t;
using ::int_fast64_t;
using ::int_least8_t;
using ::int_least16_t;
using ::int_least32_t;
using ::int_least64_t;
using ::intmax_t;
using ::intptr_t;
using ::uint8_t;
using ::uint16_t;
using ::uint32_t;
using ::uint64_t;
using ::uint_fast8_t;
using ::uint_fast16_t;
using ::uint_fast32_t;
using ::uint_fast64_t;
using ::uint_least8_t;
using ::uint_least16_t;
using ::uint_least32_t;
using ::uint_least64_t;
using ::uintmax_t;
using ::uintptr_t;
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_CSTDINT
......@@ -185,23 +185,4 @@ _GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cstdio>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cstdio>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
#endif
#endif
......@@ -215,27 +215,38 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cstdlib>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cstdlib>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
_GLIBCXX_BEGIN_NAMESPACE(std)
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
// types
using std::lldiv_t;
// functions
using std::llabs;
using std::lldiv;
#endif
using std::atoll;
using std::strtoll;
using std::strtoull;
using std::strtof;
using std::strtold;
// overloads
using std::abs;
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using std::div;
#endif
_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_USE_C99
#endif // !_GLIBCXX_HOSTED
#endif
......@@ -273,22 +273,34 @@ _GLIBCXX_END_NAMESPACE
#endif //_GLIBCXX_USE_WCHAR_T
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cwchar>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cwchar>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
#ifdef _GLIBCXX_USE_WCHAR_T
_GLIBCXX_BEGIN_NAMESPACE(std)
#if _GLIBCXX_HAVE_WCSTOF
using std::wcstof;
#endif
#if _GLIBCXX_HAVE_VFWSCANF
using std::vfwscanf;
#endif
#if _GLIBCXX_HAVE_VSWSCANF
using std::vswscanf;
#endif
#if _GLIBCXX_HAVE_VWSCANF
using std::vwscanf;
#endif
#if _GLIBCXX_USE_C99
using std::wcstold;
using std::wcstoll;
using std::wcstoull;
#endif
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_WCHAR_T
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif
......@@ -111,22 +111,19 @@ _GLIBCXX_END_NAMESPACE
#endif //_GLIBCXX_USE_WCHAR_T
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/cwctype>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/cwctype>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
#endif
#endif
#ifdef _GLIBCXX_USE_WCHAR_T
_GLIBCXX_BEGIN_NAMESPACE(std)
#if _GLIBCXX_HAVE_ISWBLANK
using std::iswblank;
#endif
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_WCHAR_T
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_CWCTYPE
......@@ -35,26 +35,236 @@
# include <bits/c++0x_warning.h>
#else
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
#endif
#include <bits/stl_algobase.h>
#include <bits/range_access.h>
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/array>
#else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/array>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
#endif
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @brief A standard container for storing a fixed size sequence of elements.
*
* @ingroup sequences
*
* Meets the requirements of a <a href="tables.html#65">container</a>, a
* <a href="tables.html#66">reversible container</a>, and a
* <a href="tables.html#67">sequence</a>.
*
* Sets support random access iterators.
*
* @param Tp Type of element. Required to be a complete type.
* @param N Number of elements.
*/
template<typename _Tp, std::size_t _Nm>
struct array
{
typedef _Tp value_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Support for zero-sized arrays mandatory.
value_type _M_instance[_Nm ? _Nm : 1];
// No explicit construct/copy/destroy for aggregate type.
// DR 776.
void
fill(const value_type& __u)
{ std::fill_n(begin(), size(), __u); }
void
swap(array& __other)
{ std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
iterator
begin()
{ return iterator(std::__addressof(_M_instance[0])); }
const_iterator
begin() const
{ return const_iterator(std::__addressof(_M_instance[0])); }
iterator
end()
{ return iterator(std::__addressof(_M_instance[_Nm])); }
const_iterator
end() const
{ return const_iterator(std::__addressof(_M_instance[_Nm])); }
reverse_iterator
rbegin()
{ return reverse_iterator(end()); }
const_reverse_iterator
rbegin() const
{ return const_reverse_iterator(end()); }
reverse_iterator
rend()
{ return reverse_iterator(begin()); }
const_reverse_iterator
rend() const
{ return const_reverse_iterator(begin()); }
const_iterator
cbegin() const
{ return const_iterator(std::__addressof(_M_instance[0])); }
const_iterator
cend() const
{ return const_iterator(std::__addressof(_M_instance[_Nm])); }
const_reverse_iterator
crbegin() const
{ return const_reverse_iterator(end()); }
const_reverse_iterator
crend() const
{ return const_reverse_iterator(begin()); }
// Capacity.
constexpr size_type
size() const { return _Nm; }
constexpr size_type
max_size() const { return _Nm; }
constexpr bool
empty() const { return size() == 0; }
// Element access.
reference
operator[](size_type __n)
{ return _M_instance[__n]; }
const_reference
operator[](size_type __n) const
{ return _M_instance[__n]; }
reference
at(size_type __n)
{
if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
const_reference
at(size_type __n) const
{
if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
reference
front()
{ return *begin(); }
const_reference
front() const
{ return *begin(); }
reference
back()
{ return _Nm ? *(end() - 1) : *end(); }
const_reference
back() const
{ return _Nm ? *(end() - 1) : *end(); }
_Tp*
data()
{ return std::__addressof(_M_instance[0]); }
const _Tp*
data() const
{ return std::__addressof(_M_instance[0]); }
};
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
return std::lexicographical_compare(__a.begin(), __a.end(),
__b.begin(), __b.end());
}
template<typename _Tp, std::size_t _Nm>
inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
// Specialized algorithms [6.2.2.2].
template<typename _Tp, std::size_t _Nm>
inline void
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
{ __one.swap(__two); }
// Tuple interface to class template array [6.2.2.5].
/// tuple_size
template<typename _Tp>
class tuple_size;
/// tuple_element
template<std::size_t _Int, typename _Tp>
class tuple_element;
template<typename _Tp, std::size_t _Nm>
struct tuple_size<array<_Tp, _Nm> >
{ static const std::size_t value = _Nm; };
template<typename _Tp, std::size_t _Nm>
const std::size_t
tuple_size<array<_Tp, _Nm> >::value;
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
struct tuple_element<_Int, array<_Tp, _Nm> >
{ typedef _Tp type; };
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
inline _Tp&
get(array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
inline const _Tp&
get(const array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
......
......@@ -35,10 +35,6 @@
# include <bits/c++0x_warning.h>
#else
#ifdef _GLIBCXX_INCLUDE_AS_TR1
# error C++0x header cannot be included from TR1 header
#endif
#include <ratio>
#include <type_traits>
#include <limits>
......@@ -46,8 +42,8 @@
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @defgroup chrono Time
* @ingroup utilities
......@@ -689,7 +685,7 @@ namespace std
} // namespace chrono
// @} group chrono
} // namespace std
_GLIBCXX_END_NAMESPACE
#endif //_GLIBCXX_USE_C99_STDINT_TR1
......
......@@ -40,8 +40,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @defgroup condition_variables Condition Variables
* @ingroup concurrency
......@@ -254,7 +254,7 @@ namespace std
};
// @} group condition_variables
}
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
......
......@@ -58,8 +58,8 @@
#include <bits/functexcept.h>
#include <bits/functional_hash.h>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
_GLIBCXX_HAS_NESTED_TYPE(result_type)
/// If we have found a result_type, extract it.
......@@ -2244,7 +2244,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
inline void
swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y)
{ __x.swap(__y); }
}
_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
......
......@@ -45,8 +45,8 @@
#include <atomic>
#include <bits/functexcept.h>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @defgroup futures Futures
* @ingroup concurrency
......@@ -1364,7 +1364,7 @@ namespace std
// && _GLIBCXX_ATOMIC_BUILTINS_4
// @} group futures
}
_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
......
......@@ -69,9 +69,6 @@
#include <bits/stl_raw_storage_iter.h>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# include <exception> // std::exception
# include <typeinfo> // std::type_info in get_deleter
# include <iosfwd> // std::basic_ostream
......@@ -86,19 +83,6 @@
# include <backward/auto_ptr.h>
# endif
# include <bits/unique_ptr.h>
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/boost_sp_counted_base.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>
# 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>
......
......@@ -48,8 +48,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @defgroup mutexes Mutexes
* @ingroup concurrency
......@@ -739,7 +739,7 @@ namespace std
}
// @} group mutexes
}
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
......
......@@ -40,8 +40,8 @@
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @defgroup ratio Rational Arithmetic
* @ingroup utilities
......@@ -339,7 +339,7 @@ namespace std
typedef ratio< 1000000000000000000, 1> exa;
// @} group ratio
}
_GLIBCXX_END_NAMESPACE
#endif //_GLIBCXX_USE_C99_STDINT_TR1
......
......@@ -46,8 +46,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
* @defgroup threads Threads
* @ingroup concurrency
......@@ -283,7 +283,7 @@ namespace std
}
// @} group threads
}
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
......
......@@ -37,8 +37,8 @@
#include <utility>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
// Adds a const reference to a non-reference type.
template<typename _Tp>
struct __add_c_ref
......@@ -791,7 +791,8 @@ namespace std
__do_cons(tuple<_Args...>&& __tuple,
const _Index_tuple<_Indexes...>&)
{ return _Tp(std::forward<_Args>(get<_Indexes>(__tuple))...); }
}
_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
......
......@@ -37,8 +37,8 @@
#include <typeinfo>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
/**
@brief The class type_index provides a simple wrapper for type_info
which can be used as an index type in associative containers (23.6)
......@@ -98,7 +98,8 @@ namespace std
operator()(const type_index& __ti) const
{ return __ti.hash_code(); }
};
}
_GLIBCXX_END_NAMESPACE
#endif // __GXX_EXPERIMENTAL_CXX0X__
......
// <utility> -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
......@@ -71,24 +71,73 @@
#include <bits/stl_pair.h>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# if defined(_GLIBCXX_INCLUDE_AS_TR1)
# error C++0x header cannot be included from TR1 header
# endif
# if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# include <tr1_impl/utility>
# else
# define _GLIBCXX_INCLUDE_AS_CXX0X
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
# define _GLIBCXX_END_NAMESPACE_TR1
# define _GLIBCXX_TR1
# include <tr1_impl/utility>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_CXX0X
# endif
# include <bits/move.h>
# include <initializer_list>
#include <bits/move.h>
#include <initializer_list>
_GLIBCXX_BEGIN_NAMESPACE(std)
template<class _Tp>
class tuple_size;
template<std::size_t _Int, class _Tp>
class tuple_element;
// Various functions which give std::pair a tuple-like interface.
template<class _Tp1, class _Tp2>
struct tuple_size<std::pair<_Tp1, _Tp2> >
{ static const std::size_t value = 2; };
template<class _Tp1, class _Tp2>
const std::size_t
tuple_size<std::pair<_Tp1, _Tp2> >::value;
template<class _Tp1, class _Tp2>
struct tuple_element<0, std::pair<_Tp1, _Tp2> >
{ typedef _Tp1 type; };
template<class _Tp1, class _Tp2>
struct tuple_element<1, std::pair<_Tp1, _Tp2> >
{ typedef _Tp2 type; };
template<std::size_t _Int>
struct __pair_get;
template<>
struct __pair_get<0>
{
template<typename _Tp1, typename _Tp2>
static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.first; }
template<typename _Tp1, typename _Tp2>
static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.first; }
};
template<>
struct __pair_get<1>
{
template<typename _Tp1, typename _Tp2>
static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
template<typename _Tp1, typename _Tp2>
static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
};
template<std::size_t _Int, class _Tp1, class _Tp2>
inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
get(std::pair<_Tp1, _Tp2>& __in)
{ return __pair_get<_Int>::__get(__in); }
template<std::size_t _Int, class _Tp1, class _Tp2>
inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
get(const std::pair<_Tp1, _Tp2>& __in)
{ return __pair_get<_Int>::__const_get(__in); }
_GLIBCXX_END_NAMESPACE
#endif
#endif /* _GLIBCXX_UTILITY */
// class template array -*- C++ -*-
// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -31,24 +32,217 @@
#pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#endif
#include <bits/stl_algobase.h>
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/array>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/array>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#endif
namespace std
{
namespace tr1
{
/**
* @brief A standard container for storing a fixed size sequence of elements.
*
* @ingroup sequences
*
* Meets the requirements of a <a href="tables.html#65">container</a>, a
* <a href="tables.html#66">reversible container</a>, and a
* <a href="tables.html#67">sequence</a>.
*
* Sets support random access iterators.
*
* @param Tp Type of element. Required to be a complete type.
* @param N Number of elements.
*/
template<typename _Tp, std::size_t _Nm>
struct array
{
typedef _Tp value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Support for zero-sized arrays mandatory.
value_type _M_instance[_Nm ? _Nm : 1];
// No explicit construct/copy/destroy for aggregate type.
void
assign(const value_type& __u)
{ std::fill_n(begin(), size(), __u); }
void
swap(array& __other)
{ std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
iterator
begin()
{ return iterator(std::__addressof(_M_instance[0])); }
const_iterator
begin() const
{ return const_iterator(std::__addressof(_M_instance[0])); }
iterator
end()
{ return iterator(std::__addressof(_M_instance[_Nm])); }
const_iterator
end() const
{ return const_iterator(std::__addressof(_M_instance[_Nm])); }
reverse_iterator
rbegin()
{ return reverse_iterator(end()); }
const_reverse_iterator
rbegin() const
{ return const_reverse_iterator(end()); }
reverse_iterator
rend()
{ return reverse_iterator(begin()); }
const_reverse_iterator
rend() const
{ return const_reverse_iterator(begin()); }
// Capacity.
size_type
size() const { return _Nm; }
size_type
max_size() const { return _Nm; }
bool
empty() const { return size() == 0; }
// Element access.
reference
operator[](size_type __n)
{ return _M_instance[__n]; }
const_reference
operator[](size_type __n) const
{ return _M_instance[__n]; }
reference
at(size_type __n)
{
if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
const_reference
at(size_type __n) const
{
if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
reference
front()
{ return *begin(); }
const_reference
front() const
{ return *begin(); }
reference
back()
{ return _Nm ? *(end() - 1) : *end(); }
const_reference
back() const
{ return _Nm ? *(end() - 1) : *end(); }
_Tp*
data()
{ return std::__addressof(_M_instance[0]); }
const _Tp*
data() const
{ return std::__addressof(_M_instance[0]); }
};
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
return std::lexicographical_compare(__a.begin(), __a.end(),
__b.begin(), __b.end());
}
template<typename _Tp, std::size_t _Nm>
inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
// Specialized algorithms [6.2.2.2].
template<typename _Tp, std::size_t _Nm>
inline void
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
{ __one.swap(__two); }
// Tuple interface to class template array [6.2.2.5].
/// tuple_size
template<typename _Tp>
class tuple_size;
/// tuple_element
template<int _Int, typename _Tp>
class tuple_element;
template<typename _Tp, std::size_t _Nm>
struct tuple_size<array<_Tp, _Nm> >
{ static const int value = _Nm; };
template<typename _Tp, std::size_t _Nm>
const int
tuple_size<array<_Tp, _Nm> >::value;
template<int _Int, typename _Tp, std::size_t _Nm>
struct tuple_element<_Int, array<_Tp, _Nm> >
{ typedef _Tp type; };
template<int _Int, typename _Tp, std::size_t _Nm>
inline _Tp&
get(array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
template<int _Int, typename _Tp, std::size_t _Nm>
inline const _Tp&
get(const array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
}
}
#endif // _GLIBCXX_TR1_ARRAY
......@@ -32,18 +32,18 @@
#include <bits/c++config.h>
#include <cctype>
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/cctype>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/cctype>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
#undef isblank
namespace std
{
namespace tr1
{
using ::isblank;
}
}
#endif
#endif // _GLIBCXX_TR1_CCTYPE
// TR1 cfenv -*- C++ -*-
// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -32,22 +32,50 @@
#pragma GCC system_header
#include <bits/c++config.h>
#if _GLIBCXX_HAVE_FENV_H
# include <fenv.h>
#endif
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/cfenv>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/cfenv>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#endif
#ifdef _GLIBCXX_USE_C99_FENV_TR1
#undef feclearexcept
#undef fegetexceptflag
#undef feraiseexcept
#undef fesetexceptflag
#undef fetestexcept
#undef fegetround
#undef fesetround
#undef fegetenv
#undef feholdexcept
#undef fesetenv
#undef feupdateenv
namespace std
{
namespace tr1
{
// types
using ::fenv_t;
using ::fexcept_t;
// functions
using ::feclearexcept;
using ::fegetexceptflag;
using ::feraiseexcept;
using ::fesetexceptflag;
using ::fetestexcept;
using ::fegetround;
using ::fesetround;
using ::fegetenv;
using ::feholdexcept;
using ::fesetenv;
using ::feupdateenv;
}
}
#endif // _GLIBCXX_USE_C99_FENV_TR1
#endif // _GLIBCXX_TR1_CFENV
// TR1 cinttypes -*- C++ -*-
// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -46,18 +46,39 @@
# endif
#endif
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/cinttypes>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/cinttypes>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1
namespace std
{
namespace tr1
{
// types
using ::imaxdiv_t;
// functions
using ::imaxabs;
// May collide with _Longlong abs(_Longlong), and is not described
// anywhere outside the synopsis. Likely, a defect.
//
// intmax_t abs(intmax_t)
using ::imaxdiv;
// Likewise, with lldiv_t div(_Longlong, _Longlong).
//
// imaxdiv_t div(intmax_t, intmax_t)
using ::strtoimax;
using ::strtoumax;
#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
using ::wcstoimax;
using ::wcstoumax;
#endif
}
}
#endif // _GLIBCXX_USE_C99_INTTYPES_TR1
#endif // _GLIBCXX_TR1_CINTTYPES
......@@ -31,10 +31,6 @@
#pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#endif
#include <bits/c++config.h>
// For 8.22.1/1 (see C99, Notes 219, 220, 222)
......@@ -58,19 +54,51 @@
# endif
# endif
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/cstdint>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/cstdint>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std
{
namespace tr1
{
using ::int8_t;
using ::int16_t;
using ::int32_t;
using ::int64_t;
using ::int_fast8_t;
using ::int_fast16_t;
using ::int_fast32_t;
using ::int_fast64_t;
using ::int_least8_t;
using ::int_least16_t;
using ::int_least32_t;
using ::int_least64_t;
using ::intmax_t;
using ::intptr_t;
using ::uint8_t;
using ::uint16_t;
using ::uint32_t;
using ::uint64_t;
using ::uint_fast8_t;
using ::uint_fast16_t;
using ::uint_fast32_t;
using ::uint_fast64_t;
using ::uint_least8_t;
using ::uint_least16_t;
using ::uint_least32_t;
using ::uint_least64_t;
using ::uintmax_t;
using ::uintptr_t;
}
}
#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif // _GLIBCXX_TR1_CSTDINT
......@@ -31,24 +31,23 @@
#pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#endif
#include <cstdio>
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/cstdio>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/cstdio>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#if _GLIBCXX_USE_C99
namespace std
{
namespace tr1
{
using std::snprintf;
using std::vsnprintf;
using std::vfscanf;
using std::vscanf;
using std::vsscanf;
}
}
#endif
#endif // _GLIBCXX_TR1_CSTDIO
// TR1 cstdlib -*- C++ -*-
// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -31,24 +31,42 @@
#pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#include <cstdlib>
#if _GLIBCXX_HOSTED
#if _GLIBCXX_USE_C99
namespace std
{
namespace tr1
{
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
// types
using std::lldiv_t;
// functions
using std::llabs;
using std::lldiv;
#endif
#include <cstdlib>
using std::atoll;
using std::strtoll;
using std::strtoull;
using std::strtof;
using std::strtold;
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/cstdlib>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/cstdlib>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
// overloads
using std::abs;
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using std::div;
#endif
}
}
#endif // _GLIBCXX_USE_C99
#endif // _GLIBCXX_HOSTED
#endif // _GLIBCXX_TR1_CSTDLIB
// TR1 cwchar -*- C++ -*-
// Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
// Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -31,24 +31,35 @@
#pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#endif
#include <cwchar>
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/cwchar>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/cwchar>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#ifdef _GLIBCXX_USE_WCHAR_T
namespace std
{
namespace tr1
{
#if _GLIBCXX_HAVE_WCSTOF
using std::wcstof;
#endif
#if _GLIBCXX_HAVE_VFWSCANF
using std::vfwscanf;
#endif
#if _GLIBCXX_HAVE_VSWSCANF
using std::vswscanf;
#endif
#if _GLIBCXX_HAVE_VWSCANF
using std::vwscanf;
#endif
#if _GLIBCXX_USE_C99
using std::wcstold;
using std::wcstoll;
using std::wcstoull;
#endif
}
}
#endif // _GLIBCXX_USE_WCHAR_T
#endif // _GLIBCXX_TR1_CWCHAR
......@@ -31,24 +31,20 @@
#pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#endif
#include <cwctype>
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/cwctype>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/cwctype>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#endif
#ifdef _GLIBCXX_USE_WCHAR_T
namespace std
{
namespace tr1
{
#if _GLIBCXX_HAVE_ISWBLANK
using std::iswblank;
#endif
}
}
#endif // _GLIBCXX_USE_WCHAR_T
#endif // _GLIBCXX_TR1_CWCTYPE
// <tr1/memory> -*- C++ -*-
// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -47,21 +48,6 @@
#include <bits/stl_function.h> // std::less
#include <debug/debug.h>
#include <tr1/type_traits>
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/boost_sp_counted_base.h>
# include <tr1/shared_ptr.h>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/boost_sp_counted_base.h>
# include <tr1/shared_ptr.h>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#endif
#include <tr1/shared_ptr.h>
#endif // _GLIBCXX_TR1_MEMORY
......@@ -49,14 +49,205 @@
#ifndef _TR1_SHARED_PTR_H
#define _TR1_SHARED_PTR_H 1
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#endif
namespace std
{
namespace tr1
{
/**
* @brief Exception possibly thrown by @c shared_ptr.
* @ingroup exceptions
*/
class bad_weak_ptr : public std::exception
{
public:
virtual char const*
what() const throw()
{ return "tr1::bad_weak_ptr"; }
};
// Substitute for bad_weak_ptr object in the case of -fno-exceptions.
inline void
__throw_bad_weak_ptr()
{
#if __EXCEPTIONS
throw bad_weak_ptr();
#else
__builtin_abort();
#endif
}
using __gnu_cxx::_Lock_policy;
using __gnu_cxx::__default_lock_policy;
using __gnu_cxx::_S_single;
using __gnu_cxx::_S_mutex;
using __gnu_cxx::_S_atomic;
// Empty helper class except when the template argument is _S_mutex.
template<_Lock_policy _Lp>
class _Mutex_base
{
protected:
// The atomic policy uses fully-fenced builtins, single doesn't care.
enum { _S_need_barriers = 0 };
};
template<>
class _Mutex_base<_S_mutex>
: public __gnu_cxx::__mutex
{
protected:
// This policy is used when atomic builtins are not available.
// The replacement atomic operations might not have the necessary
// memory barriers.
enum { _S_need_barriers = 1 };
};
template<_Lock_policy _Lp = __default_lock_policy>
class _Sp_counted_base
: public _Mutex_base<_Lp>
{
public:
_Sp_counted_base()
: _M_use_count(1), _M_weak_count(1) { }
virtual
~_Sp_counted_base() // nothrow
{ }
// Called when _M_use_count drops to zero, to release the resources
// managed by *this.
virtual void
_M_dispose() = 0; // nothrow
// Called when _M_weak_count drops to zero.
virtual void
_M_destroy() // nothrow
{ delete this; }
virtual void*
_M_get_deleter(const std::type_info&) = 0;
void
_M_add_ref_copy()
{ __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
void
_M_add_ref_lock();
void
_M_release() // nothrow
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
_M_dispose();
// There must be a memory barrier between dispose() and destroy()
// to ensure that the effects of dispose() are observed in the
// thread that runs destroy().
// See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html
if (_Mutex_base<_Lp>::_S_need_barriers)
{
_GLIBCXX_READ_MEM_BARRIER;
_GLIBCXX_WRITE_MEM_BARRIER;
}
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
-1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
_M_destroy();
}
}
}
void
_M_weak_add_ref() // nothrow
{ __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
void
_M_weak_release() // nothrow
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
if (_Mutex_base<_Lp>::_S_need_barriers)
{
// See _M_release(),
// destroy() must observe results of dispose()
_GLIBCXX_READ_MEM_BARRIER;
_GLIBCXX_WRITE_MEM_BARRIER;
}
_M_destroy();
}
}
long
_M_get_use_count() const // nothrow
{
// No memory barrier is used here so there is no synchronization
// with other threads.
return const_cast<const volatile _Atomic_word&>(_M_use_count);
}
private:
_Sp_counted_base(_Sp_counted_base const&);
_Sp_counted_base& operator=(_Sp_counted_base const&);
_Atomic_word _M_use_count; // #shared
_Atomic_word _M_weak_count; // #weak + (#shared != 0)
};
template<>
inline void
_Sp_counted_base<_S_single>::
_M_add_ref_lock()
{
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
template<>
inline void
_Sp_counted_base<_S_mutex>::
_M_add_ref_lock()
{
__gnu_cxx::__scoped_lock sentry(*this);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
template<>
inline void
_Sp_counted_base<_S_atomic>::
_M_add_ref_lock()
{
// Perform lock-free add-if-not-zero operation.
_Atomic_word __count;
do
{
__count = _M_use_count;
if (__count == 0)
__throw_bad_weak_ptr();
// Replace the current counter value with the old value + 1, as
// long as it's not changed meanwhile.
}
while (!__sync_bool_compare_and_swap(&_M_use_count, __count,
__count + 1));
}
template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
class _Sp_counted_base_impl
: public _Sp_counted_base<_Lp>
......
// TR1 utility -*- C++ -*-
// Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
// Copyright (C) 2004, 2005, 2006, 2007, 2008. 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -31,26 +32,74 @@
#pragma GCC system_header
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
# error TR1 header cannot be included from C++0x header
#endif
#include <bits/c++config.h>
#include <bits/stl_relops.h>
#include <bits/stl_pair.h>
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
# include <tr1_impl/utility>
#else
# define _GLIBCXX_INCLUDE_AS_TR1
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 tr1::
# include <tr1_impl/utility>
# undef _GLIBCXX_TR1
# undef _GLIBCXX_END_NAMESPACE_TR1
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
# undef _GLIBCXX_INCLUDE_AS_TR1
#endif
namespace std
{
namespace tr1
{
template<class _Tp>
class tuple_size;
template<int _Int, class _Tp>
class tuple_element;
// Various functions which give std::pair a tuple-like interface.
template<class _Tp1, class _Tp2>
struct tuple_size<std::pair<_Tp1, _Tp2> >
{ static const int value = 2; };
template<class _Tp1, class _Tp2>
const int
tuple_size<std::pair<_Tp1, _Tp2> >::value;
template<class _Tp1, class _Tp2>
struct tuple_element<0, std::pair<_Tp1, _Tp2> >
{ typedef _Tp1 type; };
template<class _Tp1, class _Tp2>
struct tuple_element<1, std::pair<_Tp1, _Tp2> >
{ typedef _Tp2 type; };
template<int _Int>
struct __pair_get;
template<>
struct __pair_get<0>
{
template<typename _Tp1, typename _Tp2>
static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.first; }
template<typename _Tp1, typename _Tp2>
static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.first; }
};
template<>
struct __pair_get<1>
{
template<typename _Tp1, typename _Tp2>
static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
template<typename _Tp1, typename _Tp2>
static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
};
template<int _Int, class _Tp1, class _Tp2>
inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
get(std::pair<_Tp1, _Tp2>& __in)
{ return __pair_get<_Int>::__get(__in); }
template<int _Int, class _Tp1, class _Tp2>
inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
get(const std::pair<_Tp1, _Tp2>& __in)
{ return __pair_get<_Int>::__const_get(__in); }
}
}
#endif // _GLIBCXX_TR1_UTILITY
// class template array -*- C++ -*-
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/array
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
/**
* @brief A standard container for storing a fixed size sequence of elements.
*
* @ingroup sequences
*
* Meets the requirements of a <a href="tables.html#65">container</a>, a
* <a href="tables.html#66">reversible container</a>, and a
* <a href="tables.html#67">sequence</a>.
*
* Sets support random access iterators.
*
* @param Tp Type of element. Required to be a complete type.
* @param N Number of elements.
*/
template<typename _Tp, std::size_t _Nm>
struct array
{
typedef _Tp value_type;
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
#endif
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// Support for zero-sized arrays mandatory.
value_type _M_instance[_Nm ? _Nm : 1];
// No explicit construct/copy/destroy for aggregate type.
void
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
// DR 776.
fill(const value_type& __u)
#else
assign(const value_type& __u)
#endif
{ std::fill_n(begin(), size(), __u); }
void
swap(array& __other)
{ std::swap_ranges(begin(), end(), __other.begin()); }
// Iterators.
iterator
begin()
{ return iterator(std::__addressof(_M_instance[0])); }
const_iterator
begin() const
{ return const_iterator(std::__addressof(_M_instance[0])); }
iterator
end()
{ return iterator(std::__addressof(_M_instance[_Nm])); }
const_iterator
end() const
{ return const_iterator(std::__addressof(_M_instance[_Nm])); }
reverse_iterator
rbegin()
{ return reverse_iterator(end()); }
const_reverse_iterator
rbegin() const
{ return const_reverse_iterator(end()); }
reverse_iterator
rend()
{ return reverse_iterator(begin()); }
const_reverse_iterator
rend() const
{ return const_reverse_iterator(begin()); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
const_iterator
cbegin() const
{ return const_iterator(std::__addressof(_M_instance[0])); }
const_iterator
cend() const
{ return const_iterator(std::__addressof(_M_instance[_Nm])); }
const_reverse_iterator
crbegin() const
{ return const_reverse_iterator(end()); }
const_reverse_iterator
crend() const
{ return const_reverse_iterator(begin()); }
#endif
// Capacity.
_GLIBCXX_CONSTEXPR size_type
size() const { return _Nm; }
_GLIBCXX_CONSTEXPR size_type
max_size() const { return _Nm; }
_GLIBCXX_CONSTEXPR bool
empty() const { return size() == 0; }
// Element access.
reference
operator[](size_type __n)
{ return _M_instance[__n]; }
const_reference
operator[](size_type __n) const
{ return _M_instance[__n]; }
reference
at(size_type __n)
{
if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
const_reference
at(size_type __n) const
{
if (__n >= _Nm)
std::__throw_out_of_range(__N("array::at"));
return _M_instance[__n];
}
reference
front()
{ return *begin(); }
const_reference
front() const
{ return *begin(); }
reference
back()
{ return _Nm ? *(end() - 1) : *end(); }
const_reference
back() const
{ return _Nm ? *(end() - 1) : *end(); }
_Tp*
data()
{ return std::__addressof(_M_instance[0]); }
const _Tp*
data() const
{ return std::__addressof(_M_instance[0]); }
};
// Array comparisons.
template<typename _Tp, std::size_t _Nm>
inline bool
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one == __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)
{
return std::lexicographical_compare(__a.begin(), __a.end(),
__b.begin(), __b.end());
}
template<typename _Tp, std::size_t _Nm>
inline bool
operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return __two < __one; }
template<typename _Tp, std::size_t _Nm>
inline bool
operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one > __two); }
template<typename _Tp, std::size_t _Nm>
inline bool
operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return !(__one < __two); }
// Specialized algorithms [6.2.2.2].
template<typename _Tp, std::size_t _Nm>
inline void
swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
{ __one.swap(__two); }
// Tuple interface to class template array [6.2.2.5].
/// tuple_size
template<typename _Tp>
class tuple_size;
/// tuple_element
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<std::size_t _Int, typename _Tp>
#else
template<int _Int, typename _Tp>
#endif
class tuple_element;
template<typename _Tp, std::size_t _Nm>
struct tuple_size<array<_Tp, _Nm> >
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
{ static const std::size_t value = _Nm; };
#else
{ static const int value = _Nm; };
#endif
template<typename _Tp, std::size_t _Nm>
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
const std::size_t
#else
const int
#endif
tuple_size<array<_Tp, _Nm> >::value;
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
#else
template<int _Int, typename _Tp, std::size_t _Nm>
#endif
struct tuple_element<_Int, array<_Tp, _Nm> >
{ typedef _Tp type; };
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
#else
template<int _Int, typename _Tp, std::size_t _Nm>
#endif
inline _Tp&
get(array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
#else
template<int _Int, typename _Tp, std::size_t _Nm>
#endif
inline const _Tp&
get(const array<_Tp, _Nm>& __arr)
{ return __arr[_Int]; }
_GLIBCXX_END_NAMESPACE_TR1
}
// <tr1_impl/boost_sp_counted_base.h> -*- C++ -*-
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// shared_count.hpp
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
// shared_ptr.hpp
// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes.
// Copyright (C) 2001, 2002, 2003 Peter Dimov
// weak_ptr.hpp
// Copyright (C) 2001, 2002, 2003 Peter Dimov
// enable_shared_from_this.hpp
// Copyright (C) 2002 Peter Dimov
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// GCC Note: based on version 1.32.0 of the Boost library.
/** @file tr1_impl/boost_sp_counted_base.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
/**
* @brief Exception possibly thrown by @c shared_ptr.
* @ingroup exceptions
*/
class bad_weak_ptr : public std::exception
{
public:
virtual char const*
what() const throw()
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
{ return "std::bad_weak_ptr"; }
#else
{ return "tr1::bad_weak_ptr"; }
#endif
};
// Substitute for bad_weak_ptr object in the case of -fno-exceptions.
inline void
__throw_bad_weak_ptr()
{
#if __EXCEPTIONS
throw bad_weak_ptr();
#else
__builtin_abort();
#endif
}
using __gnu_cxx::_Lock_policy;
using __gnu_cxx::__default_lock_policy;
using __gnu_cxx::_S_single;
using __gnu_cxx::_S_mutex;
using __gnu_cxx::_S_atomic;
// Empty helper class except when the template argument is _S_mutex.
template<_Lock_policy _Lp>
class _Mutex_base
{
protected:
// The atomic policy uses fully-fenced builtins, single doesn't care.
enum { _S_need_barriers = 0 };
};
template<>
class _Mutex_base<_S_mutex>
: public __gnu_cxx::__mutex
{
protected:
// This policy is used when atomic builtins are not available.
// The replacement atomic operations might not have the necessary
// memory barriers.
enum { _S_need_barriers = 1 };
};
template<_Lock_policy _Lp = __default_lock_policy>
class _Sp_counted_base
: public _Mutex_base<_Lp>
{
public:
_Sp_counted_base()
: _M_use_count(1), _M_weak_count(1) { }
virtual
~_Sp_counted_base() // nothrow
{ }
// Called when _M_use_count drops to zero, to release the resources
// managed by *this.
virtual void
_M_dispose() = 0; // nothrow
// Called when _M_weak_count drops to zero.
virtual void
_M_destroy() // nothrow
{ delete this; }
virtual void*
_M_get_deleter(const std::type_info&) = 0;
void
_M_add_ref_copy()
{ __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }
void
_M_add_ref_lock();
void
_M_release() // nothrow
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count);
_M_dispose();
// There must be a memory barrier between dispose() and destroy()
// to ensure that the effects of dispose() are observed in the
// thread that runs destroy().
// See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html
if (_Mutex_base<_Lp>::_S_need_barriers)
{
_GLIBCXX_READ_MEM_BARRIER;
_GLIBCXX_WRITE_MEM_BARRIER;
}
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,
-1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
_M_destroy();
}
}
}
void
_M_weak_add_ref() // nothrow
{ __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }
void
_M_weak_release() // nothrow
{
// Be race-detector-friendly. For more info see bits/c++config.
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)
{
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count);
if (_Mutex_base<_Lp>::_S_need_barriers)
{
// See _M_release(),
// destroy() must observe results of dispose()
_GLIBCXX_READ_MEM_BARRIER;
_GLIBCXX_WRITE_MEM_BARRIER;
}
_M_destroy();
}
}
long
_M_get_use_count() const // nothrow
{
// No memory barrier is used here so there is no synchronization
// with other threads.
return const_cast<const volatile _Atomic_word&>(_M_use_count);
}
private:
_Sp_counted_base(_Sp_counted_base const&);
_Sp_counted_base& operator=(_Sp_counted_base const&);
_Atomic_word _M_use_count; // #shared
_Atomic_word _M_weak_count; // #weak + (#shared != 0)
};
template<>
inline void
_Sp_counted_base<_S_single>::
_M_add_ref_lock()
{
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
template<>
inline void
_Sp_counted_base<_S_mutex>::
_M_add_ref_lock()
{
__gnu_cxx::__scoped_lock sentry(*this);
if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)
{
_M_use_count = 0;
__throw_bad_weak_ptr();
}
}
template<>
inline void
_Sp_counted_base<_S_atomic>::
_M_add_ref_lock()
{
// Perform lock-free add-if-not-zero operation.
_Atomic_word __count;
do
{
__count = _M_use_count;
if (__count == 0)
__throw_bad_weak_ptr();
// Replace the current counter value with the old value + 1, as
// long as it's not changed meanwhile.
}
while (!__sync_bool_compare_and_swap(&_M_use_count, __count,
__count + 1));
}
_GLIBCXX_END_NAMESPACE_TR1
}
// TR1 cctype -*- C++ -*-
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/cctype
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#if _GLIBCXX_USE_C99_CTYPE_TR1
#undef isblank
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
using ::isblank;
_GLIBCXX_END_NAMESPACE_TR1
}
#endif
// TR1 cfenv -*- C++ -*-
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/cfenv
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#if _GLIBCXX_USE_C99_FENV_TR1
#undef feclearexcept
#undef fegetexceptflag
#undef feraiseexcept
#undef fesetexceptflag
#undef fetestexcept
#undef fegetround
#undef fesetround
#undef fegetenv
#undef feholdexcept
#undef fesetenv
#undef feupdateenv
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
// types
using ::fenv_t;
using ::fexcept_t;
// functions
using ::feclearexcept;
using ::fegetexceptflag;
using ::feraiseexcept;
using ::fesetexceptflag;
using ::fetestexcept;
using ::fegetround;
using ::fesetround;
using ::fegetenv;
using ::feholdexcept;
using ::fesetenv;
using ::feupdateenv;
_GLIBCXX_END_NAMESPACE_TR1
}
#endif
// TR1 cinttypes -*- C++ -*-
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/cinttypes
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#if _GLIBCXX_USE_C99_INTTYPES_TR1
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
// types
using ::imaxdiv_t;
// functions
using ::imaxabs;
// May collide with _Longlong abs(_Longlong), and is not described
// anywhere outside the synopsis. Likely, a defect.
//
// intmax_t abs(intmax_t)
using ::imaxdiv;
// Likewise, with lldiv_t div(_Longlong, _Longlong).
//
// imaxdiv_t div(intmax_t, intmax_t)
using ::strtoimax;
using ::strtoumax;
#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
using ::wcstoimax;
using ::wcstoumax;
#endif
_GLIBCXX_END_NAMESPACE_TR1
}
#endif
// TR1 cstdint -*- C++ -*-
// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/cstdint
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#if _GLIBCXX_USE_C99_STDINT_TR1
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
using ::int8_t;
using ::int16_t;
using ::int32_t;
using ::int64_t;
using ::int_fast8_t;
using ::int_fast16_t;
using ::int_fast32_t;
using ::int_fast64_t;
using ::int_least8_t;
using ::int_least16_t;
using ::int_least32_t;
using ::int_least64_t;
using ::intmax_t;
using ::intptr_t;
using ::uint8_t;
using ::uint16_t;
using ::uint32_t;
using ::uint64_t;
using ::uint_fast8_t;
using ::uint_fast16_t;
using ::uint_fast32_t;
using ::uint_fast64_t;
using ::uint_least8_t;
using ::uint_least16_t;
using ::uint_least32_t;
using ::uint_least64_t;
using ::uintmax_t;
using ::uintptr_t;
_GLIBCXX_END_NAMESPACE_TR1
}
#endif
// TR1 cstdio -*- C++ -*-
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/cstdio
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
#if _GLIBCXX_USE_C99
using std::snprintf;
using std::vsnprintf;
using std::vfscanf;
using std::vscanf;
using std::vsscanf;
#endif
_GLIBCXX_END_NAMESPACE_TR1
}
// TR1 cstdlib -*- C++ -*-
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/cstdlib
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#if _GLIBCXX_HOSTED
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
#if _GLIBCXX_USE_C99
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
// types
using std::lldiv_t;
// functions
using std::llabs;
using std::lldiv;
#endif
using std::atoll;
using std::strtoll;
using std::strtoull;
using std::strtof;
using std::strtold;
// overloads
using std::abs;
#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC
using std::div;
#endif
#endif
_GLIBCXX_END_NAMESPACE_TR1
}
#endif
// TR1 cwchar -*- C++ -*-
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/cwchar
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#if _GLIBCXX_USE_WCHAR_T
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
#if _GLIBCXX_HAVE_WCSTOF
using std::wcstof;
#endif
#if _GLIBCXX_HAVE_VFWSCANF
using std::vfwscanf;
#endif
#if _GLIBCXX_HAVE_VSWSCANF
using std::vswscanf;
#endif
#if _GLIBCXX_HAVE_VWSCANF
using std::vwscanf;
#endif
#if _GLIBCXX_USE_C99
using std::wcstold;
using std::wcstoll;
using std::wcstoull;
#endif
_GLIBCXX_END_NAMESPACE_TR1
}
#endif
// TR1 cwctype -*- C++ -*-
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/cwctype
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
#if _GLIBCXX_USE_WCHAR_T
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
#if _GLIBCXX_HAVE_ISWBLANK
using std::iswblank;
#endif
_GLIBCXX_END_NAMESPACE_TR1
}
#endif
// TR1 utility -*- C++ -*-
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file tr1_impl/utility
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*/
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_TR1
template<class _Tp>
class tuple_size;
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<std::size_t _Int, class _Tp>
#else
template<int _Int, class _Tp>
#endif
class tuple_element;
// Various functions which give std::pair a tuple-like interface.
template<class _Tp1, class _Tp2>
struct tuple_size<std::pair<_Tp1, _Tp2> >
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
{ static const std::size_t value = 2; };
#else
{ static const int value = 2; };
#endif
template<class _Tp1, class _Tp2>
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
const std::size_t
#else
const int
#endif
tuple_size<std::pair<_Tp1, _Tp2> >::value;
template<class _Tp1, class _Tp2>
struct tuple_element<0, std::pair<_Tp1, _Tp2> >
{ typedef _Tp1 type; };
template<class _Tp1, class _Tp2>
struct tuple_element<1, std::pair<_Tp1, _Tp2> >
{ typedef _Tp2 type; };
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<std::size_t _Int>
#else
template<int _Int>
#endif
struct __pair_get;
template<>
struct __pair_get<0>
{
template<typename _Tp1, typename _Tp2>
static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.first; }
template<typename _Tp1, typename _Tp2>
static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.first; }
};
template<>
struct __pair_get<1>
{
template<typename _Tp1, typename _Tp2>
static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
template<typename _Tp1, typename _Tp2>
static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)
{ return __pair.second; }
};
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<std::size_t _Int, class _Tp1, class _Tp2>
#else
template<int _Int, class _Tp1, class _Tp2>
#endif
inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
get(std::pair<_Tp1, _Tp2>& __in)
{ return __pair_get<_Int>::__get(__in); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
template<std::size_t _Int, class _Tp1, class _Tp2>
#else
template<int _Int, class _Tp1, class _Tp2>
#endif
inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&
get(const std::pair<_Tp1, _Tp2>& __in)
{ return __pair_get<_Int>::__const_get(__in); }
_GLIBCXX_END_NAMESPACE_TR1
}
......@@ -49,8 +49,8 @@ namespace
};
} // anonymous namespace
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace __atomic0
{
bool
......@@ -115,7 +115,8 @@ namespace std
_GLIBCXX_END_EXTERN_C
} // namespace __atomic0
} // namespace std
_GLIBCXX_END_NAMESPACE
// XXX GLIBCXX_ABI Deprecated
......
......@@ -33,8 +33,8 @@
#include <sys/time.h>
#endif
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace chrono
{
const bool system_clock::is_monotonic;
......@@ -74,6 +74,7 @@ namespace std
}
#endif
}
}
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_USE_C99_STDINT_TR1
......@@ -26,8 +26,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
condition_variable::condition_variable() throw ()
{
#ifdef __GTHREAD_COND_INIT
......@@ -84,6 +84,7 @@ namespace std
condition_variable_any::~condition_variable_any() throw ()
{ }
}
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
......@@ -64,8 +64,8 @@ namespace
}
}
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
const error_category& future_category()
{ return __future_category_instance(); }
......@@ -73,4 +73,5 @@ namespace std
const char*
future_error::what() const throw() { return _M_code.message().c_str(); }
}
_GLIBCXX_END_NAMESPACE
......@@ -37,8 +37,8 @@ namespace
}
#endif
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
#ifdef _GLIBCXX_HAVE_TLS
__thread void* __once_callable;
__thread void (*__once_call)();
......@@ -88,7 +88,8 @@ namespace std
__once_call();
}
}
}
_GLIBCXX_END_NAMESPACE
// XXX GLIBCXX_ABI Deprecated
// gcc-4.6.0
......
......@@ -28,8 +28,8 @@
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(std)
namespace
{
extern "C" void*
......@@ -95,6 +95,7 @@ namespace std
__throw_system_error(__e);
}
}
}
_GLIBCXX_END_NAMESPACE
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
......@@ -19,7 +19,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// { dg-error "static assertion failed" "" { target *-*-* } 688 }
// { dg-error "static assertion failed" "" { target *-*-* } 1119 }
#include <utility>
......
......@@ -31,5 +31,5 @@ void test01()
test_type d;
}
// { dg-error "rep cannot be a duration" "" { target *-*-* } 210 }
// { dg-error "rep cannot be a duration" "" { target *-*-* } 206 }
// { dg-error "instantiated from here" "" { target *-*-* } 31 }
......@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -32,6 +32,6 @@ void test01()
test_type d;
}
// { dg-error "must be a specialization of ratio" "" { target *-*-* } 211 }
// { dg-error "must be a specialization of ratio" "" { target *-*-* } 207 }
// { dg-error "instantiated from here" "" { target *-*-* } 32 }
// { dg-excess-errors "In instantiation of" }
......@@ -3,7 +3,7 @@
// { dg-require-cstdint "" }
// 2008-07-31 Chris Fairles <chris.fairles@gmail.com>
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
......@@ -33,5 +33,5 @@ void test01()
test_type d;
}
// { dg-error "period must be positive" "" { target *-*-* } 213 }
// { dg-error "period must be positive" "" { target *-*-* } 209 }
// { dg-error "instantiated from here" "" { target *-*-* } 33 }
......@@ -48,5 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 651 }
// { dg-error "declaration of" "" { target *-*-* } 615 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1082 }
// { dg-error "declaration of" "" { target *-*-* } 1046 }
......@@ -48,5 +48,5 @@ void test01()
// { dg-error "instantiated from here" "" { target *-*-* } 40 }
// { dg-error "instantiated from here" "" { target *-*-* } 42 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 574 }
// { dg-error "declaration of" "" { target *-*-* } 538 }
// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1005 }
// { dg-error "declaration of" "" { target *-*-* } 969 }
......@@ -32,9 +32,9 @@ void test01()
{
X* px = 0;
std::shared_ptr<X> p1(px); // { dg-error "here" }
// { dg-error "incomplete" "" { target *-*-* } 566 }
// { dg-error "incomplete" "" { target *-*-* } 762 }
std::shared_ptr<X> p9(ap()); // { dg-error "here" }
// { dg-error "incomplete" "" { target *-*-* } 658 }
// { dg-error "incomplete" "" { target *-*-* } 854 }
}
......@@ -42,8 +42,8 @@ main()
}
// { dg-warning "note" "" { target *-*-* } 347 }
// { dg-warning "note" "" { target *-*-* } 1079 }
// { dg-warning "note" "" { target *-*-* } 465 }
// { dg-warning "note" "" { target *-*-* } 883 }
// { dg-warning "note" "" { target *-*-* } 580 }
// { dg-warning "note" "" { target *-*-* } 1027 }
// { dg-warning "note" "" { target *-*-* } 340 }
......
......@@ -30,9 +30,9 @@ void test01()
{
X* px = 0;
std::tr1::shared_ptr<X> p1(px); // { dg-error "here" }
// { dg-error "incomplete" "" { target *-*-* } 370 }
// { dg-error "incomplete" "" { target *-*-* } 561 }
std::tr1::shared_ptr<X> p9(ap()); // { dg-error "here" }
// { dg-error "incomplete" "" { target *-*-* } 409 }
// { dg-error "incomplete" "" { target *-*-* } 600 }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment