Files
cppdraft_translate/cppdraft/numeric/requirements.md
2025-10-25 03:02:53 +03:00

49 lines
2.6 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[numeric.requirements]
# 29 Numerics library [[numerics]](./#numerics)
## 29.2 Numeric type requirements [numeric.requirements]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L35)
Thecomplex andvalarray components are parameterized by the type of information they contain and manipulate[.](#1.sentence-1)
A C++ program shall instantiate these components only with a numeric type[.](#1.sentence-2)
A [*numeric type*](#def:type,numeric "29.2Numeric type requirements[numeric.requirements]") is a cv-unqualified object type T that meets the[*Cpp17DefaultConstructible*](utility.arg.requirements#:Cpp17DefaultConstructible "16.4.4.2Template argument requirements[utility.arg.requirements]"),[*Cpp17CopyConstructible*](utility.arg.requirements#:Cpp17CopyConstructible "16.4.4.2Template argument requirements[utility.arg.requirements]"),[*Cpp17CopyAssignable*](utility.arg.requirements#:Cpp17CopyAssignable "16.4.4.2Template argument requirements[utility.arg.requirements]"), and[*Cpp17Destructible*](utility.arg.requirements#:Cpp17Destructible "16.4.4.2Template argument requirements[utility.arg.requirements]") requirements ([[utility.arg.requirements]](utility.arg.requirements "16.4.4.2Template argument requirements"))[.](#1.sentence-3)[239](#footnote-239 "In other words, value types. These include arithmetic types, pointers, the library class complex, and instantiations of valarray for value types.")
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L59)
If any operation on T throws an exception the effects are undefined[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L63)
In addition, many member and related functions ofvalarray<T> can be successfully instantiated
and will exhibit well-defined behavior if and only ifT meets additional requirements specified for each such member
or related function[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/numerics.tex#L71)
[*Example [1](#example-1)*:
It is valid to instantiatevalarray<complex>,
butoperator>() will not be successfully instantiated forvalarray<complex> operands, sincecomplex does not have any ordering operators[.](#4.sentence-1)
— *end example*]
[239)](#footnote-239)[239)](#footnoteref-239)
In other words, value types[.](#footnote-239.sentence-1)
These include arithmetic types,
pointers, the library classcomplex,
and instantiations ofvalarray for value types[.](#footnote-239.sentence-2)