diff options
author | Jonathan Wakely <jwakely.gcc@gmail.com> | 2011-12-04 16:53:17 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2011-12-04 16:53:17 +0000 |
commit | 13901e4b28c4618bbb8cdde78896dee6a4940fa1 (patch) | |
tree | 4e54624132069aa4798540ba174cb3ff9600d6c3 /libstdc++-v3/include | |
parent | 021396710f334405addcabe1b09c274bc123c262 (diff) | |
download | gcc-13901e4b28c4618bbb8cdde78896dee6a4940fa1.tar.gz |
type_traits: Doxygen improvements.
* include/std/type_traits: Doxygen improvements.
* include/bits/move.h: Likewise.
* include/tr1/type_traits: Likewise.
* include/tr2/type_traits: Likewise.
* testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error
line numbers
* testsuite/20_util/forward/c_neg.cc: Likewise.
* testsuite/20_util/forward/f_neg.cc: Likewise.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
Likewise.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.
From-SVN: r181993
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/bits/move.h | 50 | ||||
-rw-r--r-- | libstdc++-v3/include/std/type_traits | 33 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/type_traits | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/tr2/type_traits | 6 |
4 files changed, 66 insertions, 32 deletions
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h index f5beb22bb8d..353c466d8fc 100644 --- a/libstdc++-v3/include/bits/move.h +++ b/libstdc++-v3/include/bits/move.h @@ -38,6 +38,10 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION // Used, in C++03 mode too, by allocators, etc. + /** + * @brief Same as C++11 std::addressof + * @ingroup utilities + */ template<typename _Tp> inline _Tp* __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT @@ -55,13 +59,30 @@ _GLIBCXX_END_NAMESPACE_VERSION namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// forward (as per N3143) + + /** + * @addtogroup utilities + * @{ + */ + + // forward (as per N3143) + /** + * @brief Forward an lvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + */ template<typename _Tp> constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept { return static_cast<_Tp&&>(__t); } + /** + * @brief Forward an rvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + */ template<typename _Tp> constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type&& __t) noexcept @@ -72,10 +93,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } /** - * @brief Move a value. - * @ingroup utilities + * @brief Convert a value to an rvalue. * @param __t A thing of arbitrary type. - * @return Same, moved. + * @return The parameter cast to an rvalue-reference to allow moving it. */ template<typename _Tp> constexpr typename std::remove_reference<_Tp>::type&& @@ -89,10 +109,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION is_copy_constructible<_Tp>>::type { }; /** - * @brief Move unless it could throw and the type is copyable. - * @ingroup utilities + * @brief Conditionally convert a value to an rvalue. * @param __x A thing of arbitrary type. - * @return Same, possibly moved. + * @return The parameter, possibly cast to an rvalue-reference. + * + * Same as std::move unless the type's move constructor could throw and the + * type is copyable, in which case an lvalue-reference is returned instead. */ template<typename _Tp> inline typename @@ -100,13 +122,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION move_if_noexcept(_Tp& __x) noexcept { return std::move(__x); } - /// declval, from type_traits. + // declval, from type_traits. /** * @brief Returns the actual address of the object or function * referenced by r, even in the presence of an overloaded * operator&. - * @ingroup utilities * @param __r Reference to an object or function. * @return The actual address. */ @@ -115,6 +136,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION addressof(_Tp& __r) noexcept { return std::__addressof(__r); } + /// @} group utilities _GLIBCXX_END_NAMESPACE_VERSION } // namespace @@ -130,8 +152,12 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION /** + * @addtogroup utilities + * @{ + */ + + /** * @brief Swaps two values. - * @ingroup utilities * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @return Nothing. @@ -154,6 +180,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 809. std::swap should be overloaded for array types. + /// Swap the contents of two arrays. template<typename _Tp, size_t _Nm> inline void swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) @@ -165,6 +192,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION swap(__a[__n], __b[__n]); } + /// @} group utilities _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 46e3f800cab..e3ec7ad5de5 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1,4 +1,4 @@ -// C++0x type_traits -*- C++ -*- +// C++11 type_traits -*- C++ -*- // Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // @@ -42,7 +42,13 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION /** - * @addtogroup metaprogramming + * @defgroup metaprogramming Metaprogramming and type traits + * @ingroup utilities + * + * Template utilities for compile-time introspection and modification, + * including type classification traits, type property inspection traits + * and type transformation traits. + * * @{ */ @@ -56,10 +62,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr operator value_type() { return value; } }; - /// typedef for true_type + /// The type used as a compile-time boolean with true value. typedef integral_constant<bool, true> true_type; - /// typedef for false_type + /// The type used as a compile-time boolean with false value. typedef integral_constant<bool, false> false_type; template<typename _Tp, _Tp __v> @@ -451,7 +457,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct is_compound : public integral_constant<bool, !is_fundamental<_Tp>::value> { }; - /// is_member_pointer template<typename _Tp> struct __is_member_pointer_helper : public false_type { }; @@ -460,6 +465,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __is_member_pointer_helper<_Tp _Cp::*> : public true_type { }; + /// is_member_pointer template<typename _Tp> struct is_member_pointer : public integral_constant<bool, (__is_member_pointer_helper< @@ -492,7 +498,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant<bool, __is_trivial(_Tp)> { }; - /// is_trivially_copyable (still unimplemented) + // is_trivially_copyable (still unimplemented) /// is_standard_layout template<typename _Tp> @@ -564,6 +570,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename> struct add_rvalue_reference; + /** + * @brief Utility to simplify expressions used in unevaluated operands + * @ingroup utilities + */ template<typename _Tp> typename add_rvalue_reference<_Tp>::type declval() noexcept; @@ -1702,9 +1712,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; - // Define a nested type if some predicate holds. // Primary template. - /// enable_if + /// Define a member typedef @c type only if a boolean constant is true. template<bool, typename _Tp = void> struct enable_if { }; @@ -1715,9 +1724,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typedef _Tp type; }; - // A conditional expression, but for types. If true, first, if false, second. // Primary template. - /// conditional + /// Define a member typedef @c type to one of two argument types. template<bool _Cond, typename _Iftrue, typename _Iffalse> struct conditional { typedef _Iftrue type; }; @@ -1747,14 +1755,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type; }; - /// underlying_type + /// The underlying type of an enum. template<typename _Tp> struct underlying_type { typedef __underlying_type(_Tp) type; }; - /// declval template<typename _Tp> struct __declval_protector { @@ -1892,7 +1899,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION <typename remove_cv<_Tp>::type>::value> \ { }; - // @} group metaprogramming + /// @} group metaprogramming _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits index 2825fe6f4e3..f15123ace5b 100644 --- a/libstdc++-v3/include/tr1/type_traits +++ b/libstdc++-v3/include/tr1/type_traits @@ -1,6 +1,6 @@ // TR1 type_traits -*- C++ -*- -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -41,10 +41,7 @@ namespace tr1 _GLIBCXX_BEGIN_NAMESPACE_VERSION /** - * @defgroup metaprogramming Type Traits - * @ingroup utilities - * - * Compile time type transformation and information. + * @addtogroup metaprogramming * @{ */ @@ -682,6 +679,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #undef _DEFINE_SPEC_2_HELPER #undef _DEFINE_SPEC + /// @} group metaprogramming + _GLIBCXX_END_NAMESPACE_VERSION } } diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits index 4ec41181047..9c301b30a01 100644 --- a/libstdc++-v3/include/tr2/type_traits +++ b/libstdc++-v3/include/tr2/type_traits @@ -40,9 +40,7 @@ namespace tr2 _GLIBCXX_BEGIN_NAMESPACE_VERSION /** - * @defgroup metaprogramming Type Traits - * @ingroup utilities - * + * @addtogroup metaprogramming * @{ */ @@ -111,6 +109,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typelist<__direct_bases(_Tp)...> type; }; + /// @} group metaprogramming + _GLIBCXX_END_NAMESPACE_VERSION } } |