summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/c++config4
-rw-r--r--libstdc++-v3/include/bits/char_traits.h8
-rw-r--r--libstdc++-v3/include/bits/limits_generic.h14
-rw-r--r--libstdc++-v3/include/bits/std_stdexcept.h33
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h33
5 files changed, 82 insertions, 10 deletions
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 4c46391af44..abf3f8eb7af 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -109,4 +109,8 @@
// should be cleaned up.
# define __stl_assert(expr)
+/** @namespace std
+ * @brief Everything defined by the ISO C++ Standard is within namespace std.
+ */
+
// End of prewritten config; the discovered settings follow.
diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h
index eb3f9fec3a2..a468bed90af 100644
--- a/libstdc++-v3/include/bits/char_traits.h
+++ b/libstdc++-v3/include/bits/char_traits.h
@@ -41,9 +41,9 @@
namespace std
{
- // 21.1.2 Basis for explicit _Traits specialization
- // NB: That for any given actual character type this definition is
- // probably wrong.
+ /// 21.1.2 Basis for explicit _Traits specialization
+ /// NB: That for any given actual character type this definition is
+ /// probably wrong.
template<class _CharT>
struct char_traits
{
@@ -127,7 +127,7 @@ namespace std
};
- // 21.1.4 char_traits specializations
+ /// 21.1.4 char_traits specializations
template<>
struct char_traits<char>
{
diff --git a/libstdc++-v3/include/bits/limits_generic.h b/libstdc++-v3/include/bits/limits_generic.h
index 8ad003340b0..42cae71a770 100644
--- a/libstdc++-v3/include/bits/limits_generic.h
+++ b/libstdc++-v3/include/bits/limits_generic.h
@@ -35,6 +35,11 @@
// 18.2.1
//
+/** @file limits_generic.h
+ * ISO 14882:1998
+ * 18.2.1
+ */
+
#ifndef _CPP_NUMERIC_LIMITS
#define _CPP_NUMERIC_LIMITS 1
@@ -49,6 +54,7 @@
namespace std {
+ /// Rounding style determines the behavior of floating-point calculations.
enum float_round_style {
round_indeterminate = -1,
round_toward_zero = 0,
@@ -57,12 +63,20 @@ namespace std {
round_toward_neg_infinity = 3
};
+ /// This enum signals whether a type has denormalization.
enum float_denorm_style {
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
};
+ /**
+ * [18.2.1]/1: "The numeric_limits component provides a C++ program
+ * with information about various properties of the implementation's
+ * representation of the fundamental types." All of the standard
+ * fundamental types have specializations of this class template.
+ * @brief Properties of fundamental types on a per-platform basis.
+ */
template<typename _T> struct numeric_limits {
static const bool is_specialized = false;
diff --git a/libstdc++-v3/include/bits/std_stdexcept.h b/libstdc++-v3/include/bits/std_stdexcept.h
index ee9ebf19449..66bac5011be 100644
--- a/libstdc++-v3/include/bits/std_stdexcept.h
+++ b/libstdc++-v3/include/bits/std_stdexcept.h
@@ -31,6 +31,13 @@
// ISO C++ 19.1 Exception classes
//
+/** @file std_stdexcept.h
+ * The Standard C++ library provides classes to be used to report certain
+ * errors (17.4.4.8) in C++ programs. In the error model reflected in these
+ * classes, errors are divided into two broad categories: logic errors and
+ * runtime errors.
+ */
+
#ifndef _CPP_STDEXCEPT
#define _CPP_STDEXCEPT 1
@@ -41,72 +48,98 @@
namespace std
{
+ /** Logic errors represent problems in the internal logic of a program;
+ * in theory, these are preventable, and even detectable before the
+ * program runs (e.g., violations of class invariants).
+ * @brief One of two subclasses of exception.
+ */
class logic_error : public exception
{
string _M_msg;
public:
+ /** Takes a character string describing the error. */
explicit
logic_error(const string& __arg);
virtual
~logic_error() throw();
+ /** Returns a C-style character string describing the general cause of
+ * the current error (the same string passed to the ctor). */
virtual const char*
what() const throw();
};
+ /** Thrown by the library, or by you, to report domain errors (domain in
+ * the mathmatical sense). */
class domain_error : public logic_error
{
public:
explicit domain_error(const string& __arg);
};
+ /** Thrown to report invalid arguments to functions. */
class invalid_argument : public logic_error
{
public:
explicit invalid_argument(const string& __arg);
};
+ /** Thrown when an object is constructed that would exceed its maximum
+ * permitted size (e.g., a basic_string instance). */
class length_error : public logic_error
{
public:
explicit length_error(const string& __arg);
};
+ /** This represents an argument whose value is not within the expected
+ * range (e.g., boundary checks in basic_string). */
class out_of_range : public logic_error
{
public:
explicit out_of_range(const string& __arg);
};
+ /** Runtime errors represent problems outside the scope of a program;
+ * they cannot be easily predicted and can generally only be caught as
+ * the program executes.
+ * @brief One of two subclasses of exception.
+ */
class runtime_error : public exception
{
string _M_msg;
public:
+ /** Takes a character string describing the error. */
explicit
runtime_error(const string& __arg);
virtual
~runtime_error() throw();
+ /** Returns a C-style character string describing the general cause of
+ * the current error (the same string passed to the ctor). */
virtual const char*
what() const throw();
};
+ /** Thrown to indicate range errors in internal computations. */
class range_error : public runtime_error
{
public:
explicit range_error(const string& __arg);
};
+ /** Thrown to indicate arithmetic overflow. */
class overflow_error : public runtime_error
{
public:
explicit overflow_error(const string& __arg);
};
+ /** Thrown to indicate arithmetic underflow. */
class underflow_error : public runtime_error
{
public:
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 27bc50d39a6..b10f96545f4 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -53,8 +53,9 @@
* purpose. It is provided "as is" without express or implied warranty.
*/
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
+/** @file stl_pair.h
+ * This is an internal header file, included by other STL headers. You
+ * should not attempt to use it directly.
*/
#ifndef __SGI_STL_INTERNAL_PAIR_H
@@ -63,31 +64,38 @@
namespace std
{
+/// pair holds two objects of arbitrary type.
template <class _T1, class _T2>
struct pair {
- typedef _T1 first_type;
- typedef _T2 second_type;
+ typedef _T1 first_type; ///< @c first_type is the first bound type
+ typedef _T2 second_type; ///< @c second_type is the second bound type
- _T1 first;
- _T2 second;
+ _T1 first; ///< @c first is a copy of the first object
+ _T2 second; ///< @c second is a copy of the second object
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
//265. std::pair::pair() effects overly restrictive
+ /** The default constructor creates @c first and @c second using their
+ * respective default constructors. */
pair() : first(), second() {}
#else
pair() : first(_T1()), second(_T2()) {}
#endif
+ /** Two objects may be passed to a @c pair constructor to be copied. */
pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
+ /** There is also a templated copy ctor for the @c pair class itself. */
template <class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
};
+/// Two pairs of the same type are equal iff their members are equal.
template <class _T1, class _T2>
inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{
return __x.first == __y.first && __x.second == __y.second;
}
+/// ...put link to onlinedocs here...
template <class _T1, class _T2>
inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
{
@@ -95,26 +103,39 @@ inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
(!(__y.first < __x.first) && __x.second < __y.second);
}
+/// Uses @c operator== to find the result.
template <class _T1, class _T2>
inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__x == __y);
}
+/// Uses @c operator< to find the result.
template <class _T1, class _T2>
inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return __y < __x;
}
+/// Uses @c operator< to find the result.
template <class _T1, class _T2>
inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__y < __x);
}
+/// Uses @c operator< to find the result.
template <class _T1, class _T2>
inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
return !(__x < __y);
}
+/**
+ * @brief A convenience wrapper for creating a pair from two objects.
+ * @param x The first object.
+ * @param y The second object.
+ * @return A newly-constructed pair<> object of the appropriate type.
+ *
+ * The standard requires that the objects be passed by reference-to-const,
+ * but LWG issue #181 says they should be passed by const value.
+ */
template <class _T1, class _T2>
#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
//181. make_pair() unintended behavior
OpenPOWER on IntegriCloud