tmp/tmpp6kvjqy9/{from.md → to.md}
RENAMED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
## Class `type_index` <a id="type.index">[[type.index]]</a>
|
| 2 |
|
| 3 |
### Header `<typeindex>` synopsis <a id="type.index.synopsis">[[type.index.synopsis]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
|
|
|
|
|
|
| 6 |
namespace std {
|
| 7 |
class type_index;
|
| 8 |
template<class T> struct hash;
|
| 9 |
template<> struct hash<type_index>;
|
| 10 |
}
|
|
@@ -16,29 +18,30 @@ namespace std {
|
|
| 16 |
namespace std {
|
| 17 |
class type_index {
|
| 18 |
public:
|
| 19 |
type_index(const type_info& rhs) noexcept;
|
| 20 |
bool operator==(const type_index& rhs) const noexcept;
|
| 21 |
-
bool operator!=(const type_index& rhs) const noexcept;
|
| 22 |
bool operator< (const type_index& rhs) const noexcept;
|
| 23 |
-
bool operator<= (const type_index& rhs) const noexcept;
|
| 24 |
bool operator> (const type_index& rhs) const noexcept;
|
|
|
|
| 25 |
bool operator>=(const type_index& rhs) const noexcept;
|
|
|
|
| 26 |
size_t hash_code() const noexcept;
|
| 27 |
const char* name() const noexcept;
|
|
|
|
| 28 |
private:
|
| 29 |
const type_info* target; // exposition only
|
| 30 |
// Note that the use of a pointer here, rather than a reference,
|
| 31 |
// means that the default copy/move constructor and assignment
|
| 32 |
// operators will be provided and work as expected.
|
| 33 |
};
|
| 34 |
}
|
| 35 |
```
|
| 36 |
|
| 37 |
The class `type_index` provides a simple wrapper for `type_info` which
|
| 38 |
-
can be used as an index type in associative containers
|
| 39 |
-
|
| 40 |
|
| 41 |
### `type_index` members <a id="type.index.members">[[type.index.members]]</a>
|
| 42 |
|
| 43 |
``` cpp
|
| 44 |
type_index(const type_info& rhs) noexcept;
|
|
@@ -51,40 +54,46 @@ type_index(const type_info& rhs) noexcept;
|
|
| 51 |
bool operator==(const type_index& rhs) const noexcept;
|
| 52 |
```
|
| 53 |
|
| 54 |
*Returns:* `*target == *rhs.target`.
|
| 55 |
|
| 56 |
-
``` cpp
|
| 57 |
-
bool operator!=(const type_index& rhs) const noexcept;
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
*Returns:* `*target != *rhs.target`.
|
| 61 |
-
|
| 62 |
``` cpp
|
| 63 |
bool operator<(const type_index& rhs) const noexcept;
|
| 64 |
```
|
| 65 |
|
| 66 |
*Returns:* `target->before(*rhs.target)`.
|
| 67 |
|
| 68 |
-
``` cpp
|
| 69 |
-
bool operator<=(const type_index& rhs) const noexcept;
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
*Returns:* `!rhs.target->before(*target)`.
|
| 73 |
-
|
| 74 |
``` cpp
|
| 75 |
bool operator>(const type_index& rhs) const noexcept;
|
| 76 |
```
|
| 77 |
|
| 78 |
*Returns:* `rhs.target->before(*target)`.
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
``` cpp
|
| 81 |
bool operator>=(const type_index& rhs) const noexcept;
|
| 82 |
```
|
| 83 |
|
| 84 |
*Returns:* `!target->before(*rhs.target)`.
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
``` cpp
|
| 87 |
size_t hash_code() const noexcept;
|
| 88 |
```
|
| 89 |
|
| 90 |
*Returns:* `target->hash_code()`.
|
|
|
|
| 1 |
## Class `type_index` <a id="type.index">[[type.index]]</a>
|
| 2 |
|
| 3 |
### Header `<typeindex>` synopsis <a id="type.index.synopsis">[[type.index.synopsis]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
+
#include <compare> // see [compare.syn]
|
| 7 |
+
|
| 8 |
namespace std {
|
| 9 |
class type_index;
|
| 10 |
template<class T> struct hash;
|
| 11 |
template<> struct hash<type_index>;
|
| 12 |
}
|
|
|
|
| 18 |
namespace std {
|
| 19 |
class type_index {
|
| 20 |
public:
|
| 21 |
type_index(const type_info& rhs) noexcept;
|
| 22 |
bool operator==(const type_index& rhs) const noexcept;
|
|
|
|
| 23 |
bool operator< (const type_index& rhs) const noexcept;
|
|
|
|
| 24 |
bool operator> (const type_index& rhs) const noexcept;
|
| 25 |
+
bool operator<=(const type_index& rhs) const noexcept;
|
| 26 |
bool operator>=(const type_index& rhs) const noexcept;
|
| 27 |
+
strong_ordering operator<=>(const type_index& rhs) const noexcept;
|
| 28 |
size_t hash_code() const noexcept;
|
| 29 |
const char* name() const noexcept;
|
| 30 |
+
|
| 31 |
private:
|
| 32 |
const type_info* target; // exposition only
|
| 33 |
// Note that the use of a pointer here, rather than a reference,
|
| 34 |
// means that the default copy/move constructor and assignment
|
| 35 |
// operators will be provided and work as expected.
|
| 36 |
};
|
| 37 |
}
|
| 38 |
```
|
| 39 |
|
| 40 |
The class `type_index` provides a simple wrapper for `type_info` which
|
| 41 |
+
can be used as an index type in associative containers [[associative]]
|
| 42 |
+
and in unordered associative containers [[unord]].
|
| 43 |
|
| 44 |
### `type_index` members <a id="type.index.members">[[type.index.members]]</a>
|
| 45 |
|
| 46 |
``` cpp
|
| 47 |
type_index(const type_info& rhs) noexcept;
|
|
|
|
| 54 |
bool operator==(const type_index& rhs) const noexcept;
|
| 55 |
```
|
| 56 |
|
| 57 |
*Returns:* `*target == *rhs.target`.
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
``` cpp
|
| 60 |
bool operator<(const type_index& rhs) const noexcept;
|
| 61 |
```
|
| 62 |
|
| 63 |
*Returns:* `target->before(*rhs.target)`.
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
``` cpp
|
| 66 |
bool operator>(const type_index& rhs) const noexcept;
|
| 67 |
```
|
| 68 |
|
| 69 |
*Returns:* `rhs.target->before(*target)`.
|
| 70 |
|
| 71 |
+
``` cpp
|
| 72 |
+
bool operator<=(const type_index& rhs) const noexcept;
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
*Returns:* `!rhs.target->before(*target)`.
|
| 76 |
+
|
| 77 |
``` cpp
|
| 78 |
bool operator>=(const type_index& rhs) const noexcept;
|
| 79 |
```
|
| 80 |
|
| 81 |
*Returns:* `!target->before(*rhs.target)`.
|
| 82 |
|
| 83 |
+
``` cpp
|
| 84 |
+
strong_ordering operator<=>(const type_index& rhs) const noexcept;
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
*Effects:* Equivalent to:
|
| 88 |
+
|
| 89 |
+
``` cpp
|
| 90 |
+
if (*target == *rhs.target) return strong_ordering::equal;
|
| 91 |
+
if (target->before(*rhs.target)) return strong_ordering::less;
|
| 92 |
+
return strong_ordering::greater;
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
``` cpp
|
| 96 |
size_t hash_code() const noexcept;
|
| 97 |
```
|
| 98 |
|
| 99 |
*Returns:* `target->hash_code()`.
|