2
0
mirror of https://github.com/boostorg/graph.git synced 2026-02-26 04:42:16 +00:00
Files
graph/quickbook/concepts/numeric_value.qbk
Andrew Sutton e54ede1993 Working on quickbook docs.
Restructuring parts of the user's guide.
Removed some concepts and fixed issues with others.
Added (incomplete) adjacency_matrix docs.


[SVN r55976]
2009-09-02 14:23:27 +00:00

81 lines
2.6 KiB
Plaintext

[/
/ Copyright (C) 2007-2009 Andrew Sutton
/
/ 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)
/]
[/ TODO: This concept is fundamentally broken. It's trying to capture the
/ association of named constants with a type or a particular use. We probably
/ need to explore the design space of named concepts before we can really
/ attribute this as a legitimate operation.
/
/ For example, why are these required to be scoped? Why not simply use the
/ functions zero<T>() and infinity<T>()?
/]
[section Numeric Value]
The [NumericValue] concept describes requirements for a type to behave
as if it were numeric. This concept is generally used by algorithms that
typically operate on numeric types, but can be specialized to operate on
user-defined numerics or discrete types that emulate numerics.
This concept requires that its models be regular (i.e., default and copy
constructible, assignable, and equality comparable). Additioanlly, this
concept requires all common mathematical operators (i.e., addition, subtraction,
multiplication and division).
Finally, this concept requires that its models define appropriate values of
zero and infinity. These are used within certain computations to represent
infinite and zero states.
[heading Notation]
The following expressions are used within this document:
[table
[[Expression] [Description]]
[[N] [A type modeling the [NumericValue] concept.]]
]
[heading Associated Types]
[table
[[Name] [Type] [Description]]
[
[Value Type]
[`numeric_value<N>::value_type`]
[
The underlying type of the numeric value.
*Requirements:* `N` is a [NumericValue], and the `value_type`
and `N` must be the same type.
]
]
]
[heading Expressions]
[table
[[Name] [Expression] [Result Type] [Description]]
[
[Zero Value]
[`numeric_value<N>::zero()`]
[`numeric_value<N>::value_type`]
[
Returns the zero-value of the numeric type.
]
]
[
[Infinite Value]
[`numeric_value<N>::infinity()`]
[`numeric_value<N>::value_type`]
[
Returns the designated value of infinity for the numeric type.
*Notes:* Some types such as `float` and `double` have values
that represent infinity. For other types, this must be explicitly
designated. For built-in integral types this is often chosen to
be `std::numeric_limits<N>::max()`.
]
]
]
[endsect]