diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-02 18:51:23 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-02 18:51:23 +0000 |
commit | 5022cf3fd984dceee96249a354ec2074092c2988 (patch) | |
tree | f32ef83a6c9e3e08f28de6c5c9acb9beae030e04 /libstdc++-v3/include/std/utility | |
parent | 32a7faa5b5cc086184805968ad5cfe33a2d44044 (diff) | |
download | gcc-5022cf3fd984dceee96249a354ec2074092c2988.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166211 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/utility')
-rw-r--r-- | libstdc++-v3/include/std/utility | 87 |
1 files changed, 68 insertions, 19 deletions
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index c3826eaca6b..e54a5868c90 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -1,6 +1,6 @@ // <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 */ |