|
Boost-Commit : |
From: asutton_at_[hidden]
Date: 2007-08-16 21:16:48
Author: asutton
Date: 2007-08-16 21:16:46 EDT (Thu, 16 Aug 2007)
New Revision: 38736
URL: http://svn.boost.org/trac/boost/changeset/38736
Log:
Updates to various docs
Text files modified:
sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/assignable.qbk | 20 ++++++++++----------
sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/copy_constructible.qbk | 40 ++++++++++++++++++++++++----------------
sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/default_constructible.qbk | 27 ++++++++++++++-------------
sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/destructible.qbk | 28 ++++++++++++++++++++++------
sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/equality_comparable.qbk | 9 +++++----
5 files changed, 75 insertions(+), 49 deletions(-)
Modified: sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/assignable.qbk
==============================================================================
--- sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/assignable.qbk (original)
+++ sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/assignable.qbk 2007-08-16 21:16:46 EDT (Thu, 16 Aug 2007)
@@ -8,14 +8,17 @@
[section Assignable]
A type `T` is /assignable/ if an object of type `T` can be assigned
the value of another object `u` using the assignment operator. The type
-of `u` is either `T` or `const T`. A type `T` is assignable if it has
-a compiler-generated or user-defined assignment operator. After the
+of `u` is either `T` or `const T`. A type `T` is assignable if it has
+a compiler-generated or user-defined assignment operator. After the
assignment the object `t` is equivalent to `u`.
+This type of assignment is properly referred to as /copy assignment/ since both
+assignment operators and constructors can be provided for types that are not
+`T` or `const T`, and those operators do not have copy semantics.
+
[note
-This type of assignment is properly referred to as /copy assignment/
-since, after the copy operation since both assignment operators and
-constructors can be provided for types that are not `T` or `const T`.
+Two objects `t` and `u` are equivalent if the expression `t == u` returns
+`true`. See [StdEqualityComparable] for more information.
]
[heading Notation]
@@ -23,7 +26,7 @@
[[Expression] [Description]]
[[T] [An [StdAssignable] type.]]
[[t] [An instance of type `T`.]]
- [[u] [An instance of type 'const `T`.]]
+ [[u] [An instance of type `T` or const `T`.]]
]
[heading Requirements]
@@ -46,10 +49,7 @@
A type `T` is required to be [StdAssignable] when an object of type `T` is
assigned to an object of type `T` or `const T`.
- // This function requires T to be ``[StdAssignable]`` because it assigns
- // an object of type `T` to the value of another object of the same type.
- // If T is not assignable, calling this function will result in a compiler
- // error.
+ // The assignment of the object t to the value u requires T to be Assignable.
template <typename T>
void assign(T& t, const T& u)
{
Modified: sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/copy_constructible.qbk
==============================================================================
--- sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/copy_constructible.qbk (original)
+++ sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/copy_constructible.qbk 2007-08-16 21:16:46 EDT (Thu, 16 Aug 2007)
@@ -7,10 +7,10 @@
[section Copy Constructible]
A type `T` is /copy constructible/ if it an object `t` of type `T` can
-be constructed as a copy of another object `u`. The type of `u` is either
-`T` or `const T`. A type `T` is only copy constructible if it has either a
-compiler-generated or user-defined copy constructor that accepts a single
-argument: a `const` reference to `T`. After copy construction, the
+be constructed as a copy of another object `u`. The type of `u` is either
+`T` or `const T`. A type `T` is only copy constructible if it has either a
+compiler-generated or user-defined copy constructor that accepts a single
+argument: a `const` reference to `T`. After copy construction, the
constructed object is equivalent to the object passed as an argument.
[note
@@ -36,7 +36,7 @@
[
[Copy Constructor]
[
- `T t(u);`[br/]
+ `T t(u);`[br]
`T t = u;`
]
[]
@@ -44,6 +44,8 @@
The object `t` is declared as an object of type `T` whose
value or state is equivalent to `u`
+ *Requirements:* The type of `u` is either `T` or `const T`.
+
*Postcondition:* `t` is equivalent to `u`.
]
]
@@ -55,6 +57,8 @@
Construct an object of type `T` whose value or state is
equivalent to `u`.
+ *Requirements:* The type of `u` is either `T` or `const T`.
+
*Postcondition:* `t` is equivalent to `u`.
]
]
@@ -65,28 +69,32 @@
[StdCopyConstructible]. These types are called non-copyable types.
[heading Examples]
-A type `T` is required to be [StdCopyConstructible] when an object of type `T`
+A type `T` is required to be [StdCopyConstructible] when an object of type `T`
is when the copy constructor of `T` is invoked passing another object of
type `T` as an argument.
- // This function requires T to be ``[StdCopyConstructible]`` because
- // it declares an object of type T constructed with the value of u. If
- // T is not ``[StdCopyConstructible]``, calling this function will
- // result in a compiler error.
+ // Declaring a new object of type T as a copy of another requires T to be
+ // CopyConstructible.
template <typename T>
void copy_declare(const T& u)
{
T t(u);
}
-
- // This function requires T to be ``[StdCopyConstructible]`` because
- // it explitcly constructs a copy of an object of the same type. If
- // T is not ``[StdCopyConstructible]``, then calling this function will
- // result in a compiler error.
+
+ // Explicitly constructing an object of type T and passing an object of type
+ // T or const T to the copy constructor requires T to be CopyConstructible.
template <typename T>
T copy_construct(const T& u)
{
return T(u);
}
-[endsect]
\ No newline at end of file
+ // Allocating a new object of type T and passing an object of type T or
+ // const T to the copy constructor requires T to be CopyConstructible.
+ template <typename T>
+ T* dynamic_copy_construct(const T& u)
+ {
+ return new T(u);
+ }
+
+[endsect]
Modified: sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/default_constructible.qbk
==============================================================================
--- sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/default_constructible.qbk (original)
+++ sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/default_constructible.qbk 2007-08-16 21:16:46 EDT (Thu, 16 Aug 2007)
@@ -9,11 +9,11 @@
A type `T` is /default constructible/ if objects of type `T` can be constructed
without providing any arguments to a constructor. A type that is default
constructible has either a compiler-generated or user-defined constructor
-that can be called without arguments.
+that can be called without arguments.
[note
-[StdDefaultConstructible] types may or may not initilize objects to a default value
-or state depending on the type itself and the syntax used for construction. Objects
+[StdDefaultConstructible] types may or may not initilize objects to a default value
+or state depending on the type itself and the syntax used for construction. Objects
that are not initialized to a default are /uninitialized. Reading from or otherwise
using uninitialized objects often results in undefined behavior.
]
@@ -62,27 +62,28 @@
A type `T` is required to be [StdDefaultConstructible] when an object of type `T` is
declared or when the default constructor of `T` is invoked without arguments.
- // This functions requires T to be ``[StdDefaultConstructible]`` because it
- // declares an object of type T without providing any arguments to the default
- // constructor. If T is not ``[StdDefaultConstructible]``, calling this function
- // will result in a compiler error.
+ // Declaring a variable without explicitly calling a constructor requires a
+ // T to be DefaultConstructible.
template <typename T>
void default_declare()
{
T x;
}
- // This function requires T to be ``[StdDefaultConstructible]`` because it
- // explicitly invokes a constructor of T wihtout any arguments. If T is not
- // ``[StdDefaultConstructible]``, calling this function will result in a
- // compiler error.
+ // Explcitly invoking the default constructor (or a constructor that can
+ // be invoked without arguments) requires T to be DefaultConstructible.
template <typename T>
T default_construct()
{
return T();
}
-[heading Models]
-All fundamental types such as `bool`, `int`, and `float` are [StdDefaultConstructible].
+ // Allocating a new object of type T, invoking the default constructor
+ // requires T to be DefaultConstructible.
+ template <typename T>
+ T* dynamic_default_construct()
+ {
+ return new T(); // This is equivalent to "new T"
+ }
[endsect]
\ No newline at end of file
Modified: sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/destructible.qbk
==============================================================================
--- sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/destructible.qbk (original)
+++ sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/destructible.qbk 2007-08-16 21:16:46 EDT (Thu, 16 Aug 2007)
@@ -6,8 +6,8 @@
/]
[section Destructible]
-A type `T` is /destructible/ if it has a public destructor. The
-destructor can be either compiler-generated or user-defined.
+A type `T` is /destructible/ if it has a public destructor. The destructor can
+be either compiler-generated or user-defined.
[heading Notation]
The following expressions are used within this document:
@@ -42,13 +42,29 @@
[StdDestructible] concept. Any type whose objects are `delete`d are also required
to be [StdDestructible].
- // This function requires T to be ``[StdDestructible]`` because it
- // explicitly invokes the destructor. If T is not destructible,
- // calling this function will result in a compiler error.
+ // An object of type T that goes out of scope is required to be
+ // Destructible. Note that this function also requires T to be
+ // DefaultConstructible.
template <typename T>
- void destruct(T& t)
+ void implicit_destruct()
+ {
+ T t;
+ } // Destructor is called here
+
+ // Invoking the desctructor of an object of type T requires the type to be
+ // Destructible.
+ template <typename T>
+ void explicit_destruct(T& t)
{
t.~T();
}
+ // Deleting a dynamically allocated object of type T requires the type to be
+ // Destructible.
+ template <typename T>
+ void dynamic_destruct(T* t)
+ {
+ delete t;
+ }
+
[endsect]
\ No newline at end of file
Modified: sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/equality_comparable.qbk
==============================================================================
--- sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/equality_comparable.qbk (original)
+++ sandbox/boost_docs/trunk/libs/standard/doc/concepts/utilities/equality_comparable.qbk 2007-08-16 21:16:46 EDT (Thu, 16 Aug 2007)
@@ -6,10 +6,11 @@
/]
[section Equality Comparable]
-A type `T` is said to be /equality comparable/ if it defines an /equivalence relation/
-and can be compared using the equality comparison operator (`==`). An equivalence
-relation is a binary relation between any two instances of `T` that denotes them as
-being "equivalent". Note that the meaning of equivalent depends on the type.
+A type `T` is /equality comparable/ if it defines an /equivalence relation/ and
+can be compared using the equality comparison operator (`==`). An equivalence
+relation is a binary relation between any two objects of type `T` that denotes
+them as being "equivalent". Note that the meaning of equivalent depends on the type.
+
Equivalence relations are required to be /reflexive/, /symmetric/, and /transitive/.
Equality comparability also introduces the notion of /identity/ for instances of a
type. This states that an instance of a [StdEqualityComparable] is equivalent
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk