Skip to content

Commit c5c771e

Browse files
committed
[type.index] Move [type.index] into subclause [support.rtti]
The subclause is integrated into the structure of [support.rtti], meaning that the synopsis becomes a sibling of the rest, and the subdivisions of the remaining text are removed (in analogy with [type.info]). Part of the C++26 clause restructuring (#5315).
1 parent 7a2dafa commit c5c771e

File tree

3 files changed

+174
-172
lines changed

3 files changed

+174
-172
lines changed

source/support.tex

+167-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
\ref{support.arith.types} & Arithmetic types & \tcode{<cstdint>}, \tcode{<stdfloat>} \\ \rowsep
3030
\ref{support.start.term} & Start and termination & \tcode{<cstdlib>} \\ \rowsep
3131
\ref{support.dynamic} & Dynamic memory management & \tcode{<new>} \\ \rowsep
32-
\ref{support.rtti} & Type identification & \tcode{<typeinfo>} \\ \rowsep
32+
\ref{support.rtti} & Type identification & \tcode{<typeinfo>}, \tcode{<typeindex>} \\ \rowsep
3333
\ref{support.srcloc} & Source location & \tcode{<source_location>} \\ \rowsep
3434
\ref{support.exception} & Exception handling & \tcode{<exception>} \\ \rowsep
35-
\ref{support.initlist} & Initializer lists & \tcode{<initializer_list>} \\ \rowsep
35+
\ref{support.initlist} & Initializer lists & \tcode{<initializer_list>} \\ \rowsep
3636
\ref{cmp} & Comparisons & \tcode{<compare>} \\ \rowsep
3737
\ref{support.coroutine} & Coroutines & \tcode{<coroutine>} \\ \rowsep
3838
\ref{support.runtime} & Other runtime support &
@@ -3180,12 +3180,16 @@
31803180
\rSec2[support.rtti.general]{General}
31813181

31823182
\pnum
3183-
The header \libheaderdef{typeinfo} defines a
3183+
The header \libheaderref{typeinfo} defines a
31843184
type associated with type information generated by the implementation.
31853185
It also defines two types for reporting dynamic type identification errors.
3186+
The header \libheaderrefx{typeindex}{type.index.synopsis} defines
3187+
a wrapper type for use as an index type in associative containers\iref{associative}
3188+
and in unordered associative containers\iref{unord}.
31863189

31873190
\rSec2[typeinfo.syn]{Header \tcode{<typeinfo>} synopsis}
31883191

3192+
\indexheader{typeinfo}%
31893193
\indexlibraryglobal{type_info}%
31903194
\indexlibraryglobal{bad_cast}%
31913195
\indexlibraryglobal{bad_typeid}%
@@ -3365,6 +3369,166 @@
33653369
An \impldef{return value of \tcode{bad_typeid::what}} \ntbs{}.
33663370
\end{itemdescr}
33673371

3372+
\rSec2[type.index.synopsis]{Header \tcode{<typeindex>} synopsis}
3373+
3374+
\indexheader{typeindex}%
3375+
\begin{codeblock}
3376+
#include <compare> // see \ref{compare.syn}
3377+
3378+
namespace std {
3379+
class type_index;
3380+
template<class T> struct hash;
3381+
template<> struct hash<type_index>;
3382+
}
3383+
\end{codeblock}
3384+
3385+
\rSec2[type.index]{Class \tcode{type_index}}
3386+
3387+
\indexlibraryglobal{type_index}%
3388+
\begin{codeblock}
3389+
namespace std {
3390+
class type_index {
3391+
public:
3392+
type_index(const type_info& rhs) noexcept;
3393+
bool operator==(const type_index& rhs) const noexcept;
3394+
bool operator< (const type_index& rhs) const noexcept;
3395+
bool operator> (const type_index& rhs) const noexcept;
3396+
bool operator<=(const type_index& rhs) const noexcept;
3397+
bool operator>=(const type_index& rhs) const noexcept;
3398+
strong_ordering operator<=>(const type_index& rhs) const noexcept;
3399+
size_t hash_code() const noexcept;
3400+
const char* name() const noexcept;
3401+
3402+
private:
3403+
const type_info* target; // \expos
3404+
// Note that the use of a pointer here, rather than a reference,
3405+
// means that the default copy/move constructor and assignment
3406+
// operators will be provided and work as expected.
3407+
};
3408+
}
3409+
\end{codeblock}
3410+
3411+
\pnum
3412+
The class \tcode{type_index} provides a simple wrapper for
3413+
\tcode{type_info} which can be used as an index type in associative
3414+
containers\iref{associative} and in unordered associative
3415+
containers\iref{unord}.
3416+
3417+
\indexlibraryctor{type_index}%
3418+
\begin{itemdecl}
3419+
type_index(const type_info& rhs) noexcept;
3420+
\end{itemdecl}
3421+
3422+
\begin{itemdescr}
3423+
\pnum
3424+
\effects
3425+
Constructs a \tcode{type_index} object, the equivalent of \tcode{target = \&rhs}.
3426+
\end{itemdescr}
3427+
3428+
\indexlibrarymember{operator==}{type_index}%
3429+
\begin{itemdecl}
3430+
bool operator==(const type_index& rhs) const noexcept;
3431+
\end{itemdecl}
3432+
3433+
\begin{itemdescr}
3434+
\pnum
3435+
\returns
3436+
\tcode{*target == *rhs.target}.
3437+
\end{itemdescr}
3438+
3439+
\indexlibrarymember{operator<}{type_index}%
3440+
\begin{itemdecl}
3441+
bool operator<(const type_index& rhs) const noexcept;
3442+
\end{itemdecl}
3443+
3444+
\begin{itemdescr}
3445+
\pnum
3446+
\returns
3447+
\tcode{target->before(*rhs.target)}.
3448+
\end{itemdescr}
3449+
3450+
\indexlibrarymember{operator>}{type_index}%
3451+
\begin{itemdecl}
3452+
bool operator>(const type_index& rhs) const noexcept;
3453+
\end{itemdecl}
3454+
3455+
\begin{itemdescr}
3456+
\pnum
3457+
\returns
3458+
\tcode{rhs.target->before(*target)}.
3459+
\end{itemdescr}
3460+
3461+
\indexlibrarymember{operator<=}{type_index}%
3462+
\begin{itemdecl}
3463+
bool operator<=(const type_index& rhs) const noexcept;
3464+
\end{itemdecl}
3465+
3466+
\begin{itemdescr}
3467+
\pnum
3468+
\returns
3469+
\tcode{!rhs.target->before(*target)}.
3470+
\end{itemdescr}
3471+
3472+
\indexlibrarymember{operator>=}{type_index}%
3473+
\begin{itemdecl}
3474+
bool operator>=(const type_index& rhs) const noexcept;
3475+
\end{itemdecl}
3476+
3477+
\begin{itemdescr}
3478+
\pnum
3479+
\returns
3480+
\tcode{!target->before(*rhs.target)}.
3481+
\end{itemdescr}
3482+
3483+
\indexlibrarymember{operator<=>}{type_index}%
3484+
\begin{itemdecl}
3485+
strong_ordering operator<=>(const type_index& rhs) const noexcept;
3486+
\end{itemdecl}
3487+
3488+
\begin{itemdescr}
3489+
\pnum
3490+
\effects
3491+
Equivalent to:
3492+
\begin{codeblock}
3493+
if (*target == *rhs.target) return strong_ordering::equal;
3494+
if (target->before(*rhs.target)) return strong_ordering::less;
3495+
return strong_ordering::greater;
3496+
\end{codeblock}
3497+
\end{itemdescr}
3498+
3499+
\indexlibrarymember{hash_code}{type_index}%
3500+
\begin{itemdecl}
3501+
size_t hash_code() const noexcept;
3502+
\end{itemdecl}
3503+
3504+
\begin{itemdescr}
3505+
\pnum
3506+
\returns
3507+
\tcode{target->hash_code()}.
3508+
\end{itemdescr}
3509+
3510+
\indexlibrarymember{name}{type_index}%
3511+
\begin{itemdecl}
3512+
const char* name() const noexcept;
3513+
\end{itemdecl}
3514+
3515+
\begin{itemdescr}
3516+
\pnum
3517+
\returns
3518+
\tcode{target->name()}.
3519+
\end{itemdescr}
3520+
3521+
\indexlibrarymember{hash}{type_index}%
3522+
\begin{itemdecl}
3523+
template<> struct hash<type_index>;
3524+
\end{itemdecl}
3525+
3526+
\begin{itemdescr}
3527+
\pnum
3528+
For an object \tcode{index} of type \tcode{type_index},
3529+
\tcode{hash<type_index>()(index)} shall evaluate to the same result as \tcode{index.hash_code()}.
3530+
\end{itemdescr}
3531+
33683532
\rSec1[support.srcloc]{Source location}
33693533

33703534
\rSec2[source.location.syn]{Header \tcode{<source_location>} synopsis}

source/utilities.tex

+2-169
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
\ref{expected} & Expected objects & \tcode{<expected>} \\ \rowsep
2020
\ref{bitset} & Fixed-size sequences of bits & \tcode{<bitset>} \\ \rowsep
2121
\ref{function.objects} & Function objects & \tcode{<functional>} \\ \rowsep
22-
\ref{type.index} & Type indexes & \tcode{<typeindex>} \\ \rowsep
2322
\ref{charconv} & Primitive numeric conversions & \tcode{<charconv>} \\ \rowsep
2423
\ref{format} & Formatting & \tcode{<format>} \\ \rowsep
2524
\ref{bit} & Bit manipulation & \tcode{<bit>} \\
@@ -15049,172 +15048,6 @@
1504915048
program-defined specialization.
1505015049
\end{itemize}
1505115050

15052-
\rSec1[type.index]{Class \tcode{type_index}}
15053-
15054-
\rSec2[type.index.synopsis]{Header \tcode{<typeindex>} synopsis}
15055-
15056-
\indexheader{typeindex}%
15057-
\begin{codeblock}
15058-
#include <compare> // see \ref{compare.syn}
15059-
15060-
namespace std {
15061-
class type_index;
15062-
template<class T> struct hash;
15063-
template<> struct hash<type_index>;
15064-
}
15065-
\end{codeblock}
15066-
15067-
\rSec2[type.index.overview]{\tcode{type_index} overview}
15068-
15069-
\indexlibraryglobal{type_index}%
15070-
\begin{codeblock}
15071-
namespace std {
15072-
class type_index {
15073-
public:
15074-
type_index(const type_info& rhs) noexcept;
15075-
bool operator==(const type_index& rhs) const noexcept;
15076-
bool operator< (const type_index& rhs) const noexcept;
15077-
bool operator> (const type_index& rhs) const noexcept;
15078-
bool operator<=(const type_index& rhs) const noexcept;
15079-
bool operator>=(const type_index& rhs) const noexcept;
15080-
strong_ordering operator<=>(const type_index& rhs) const noexcept;
15081-
size_t hash_code() const noexcept;
15082-
const char* name() const noexcept;
15083-
15084-
private:
15085-
const type_info* target; // \expos
15086-
// Note that the use of a pointer here, rather than a reference,
15087-
// means that the default copy/move constructor and assignment
15088-
// operators will be provided and work as expected.
15089-
};
15090-
}
15091-
\end{codeblock}
15092-
15093-
\pnum
15094-
The class \tcode{type_index} provides a simple wrapper for
15095-
\tcode{type_info} which can be used as an index type in associative
15096-
containers\iref{associative} and in unordered associative
15097-
containers\iref{unord}.
15098-
15099-
\rSec2[type.index.members]{\tcode{type_index} members}
15100-
15101-
\indexlibraryctor{type_index}%
15102-
\begin{itemdecl}
15103-
type_index(const type_info& rhs) noexcept;
15104-
\end{itemdecl}
15105-
15106-
\begin{itemdescr}
15107-
\pnum
15108-
\effects
15109-
Constructs a \tcode{type_index} object, the equivalent of \tcode{target = \&rhs}.
15110-
\end{itemdescr}
15111-
15112-
\indexlibrarymember{operator==}{type_index}%
15113-
\begin{itemdecl}
15114-
bool operator==(const type_index& rhs) const noexcept;
15115-
\end{itemdecl}
15116-
15117-
\begin{itemdescr}
15118-
\pnum
15119-
\returns
15120-
\tcode{*target == *rhs.target}.
15121-
\end{itemdescr}
15122-
15123-
\indexlibrarymember{operator<}{type_index}%
15124-
\begin{itemdecl}
15125-
bool operator<(const type_index& rhs) const noexcept;
15126-
\end{itemdecl}
15127-
15128-
\begin{itemdescr}
15129-
\pnum
15130-
\returns
15131-
\tcode{target->before(*rhs.target)}.
15132-
\end{itemdescr}
15133-
15134-
\indexlibrarymember{operator>}{type_index}%
15135-
\begin{itemdecl}
15136-
bool operator>(const type_index& rhs) const noexcept;
15137-
\end{itemdecl}
15138-
15139-
\begin{itemdescr}
15140-
\pnum
15141-
\returns
15142-
\tcode{rhs.target->before(*target)}.
15143-
\end{itemdescr}
15144-
15145-
\indexlibrarymember{operator<=}{type_index}%
15146-
\begin{itemdecl}
15147-
bool operator<=(const type_index& rhs) const noexcept;
15148-
\end{itemdecl}
15149-
15150-
\begin{itemdescr}
15151-
\pnum
15152-
\returns
15153-
\tcode{!rhs.target->before(*target)}.
15154-
\end{itemdescr}
15155-
15156-
\indexlibrarymember{operator>=}{type_index}%
15157-
\begin{itemdecl}
15158-
bool operator>=(const type_index& rhs) const noexcept;
15159-
\end{itemdecl}
15160-
15161-
\begin{itemdescr}
15162-
\pnum
15163-
\returns
15164-
\tcode{!target->before(*rhs.target)}.
15165-
\end{itemdescr}
15166-
15167-
\indexlibrarymember{operator<=>}{type_index}%
15168-
\begin{itemdecl}
15169-
strong_ordering operator<=>(const type_index& rhs) const noexcept;
15170-
\end{itemdecl}
15171-
15172-
\begin{itemdescr}
15173-
\pnum
15174-
\effects
15175-
Equivalent to:
15176-
\begin{codeblock}
15177-
if (*target == *rhs.target) return strong_ordering::equal;
15178-
if (target->before(*rhs.target)) return strong_ordering::less;
15179-
return strong_ordering::greater;
15180-
\end{codeblock}
15181-
\end{itemdescr}
15182-
15183-
\indexlibrarymember{hash_code}{type_index}%
15184-
\begin{itemdecl}
15185-
size_t hash_code() const noexcept;
15186-
\end{itemdecl}
15187-
15188-
\begin{itemdescr}
15189-
\pnum
15190-
\returns
15191-
\tcode{target->hash_code()}.
15192-
\end{itemdescr}
15193-
15194-
\indexlibrarymember{name}{type_index}%
15195-
\begin{itemdecl}
15196-
const char* name() const noexcept;
15197-
\end{itemdecl}
15198-
15199-
\begin{itemdescr}
15200-
\pnum
15201-
\returns
15202-
\tcode{target->name()}.
15203-
\end{itemdescr}
15204-
15205-
\rSec2[type.index.hash]{Hash support}
15206-
15207-
\indexlibrarymember{hash}{type_index}%
15208-
\begin{itemdecl}
15209-
template<> struct hash<type_index>;
15210-
\end{itemdecl}
15211-
15212-
\begin{itemdescr}
15213-
\pnum
15214-
For an object \tcode{index} of type \tcode{type_index},
15215-
\tcode{hash<type_index>()(index)} shall evaluate to the same result as \tcode{index.hash_code()}.
15216-
\end{itemdescr}
15217-
1521815051
\rSec1[charconv]{Primitive numeric conversions}
1521915052

1522015053
\rSec2[charconv.syn]{Header \tcode{<charconv>} synopsis}
@@ -15233,14 +15066,14 @@
1523315066

1523415067
\indexheader{charconv}%
1523515068
\begin{codeblock}
15069+
namespace std {
1523615070
@%
1523715071
\indexlibraryglobal{chars_format}%
1523815072
\indexlibrarymember{scientific}{chars_format}%
1523915073
\indexlibrarymember{fixed}{chars_format}%
1524015074
\indexlibrarymember{hex}{chars_format}%
1524115075
\indexlibrarymember{general}{chars_format}%
15242-
@namespace std {
15243-
// floating-point format for primitive numerical conversion
15076+
@ // floating-point format for primitive numerical conversion
1524415077
enum class chars_format {
1524515078
scientific = @\unspec@,
1524615079
fixed = @\unspec@,

0 commit comments

Comments
 (0)