mirror of
https://github.com/boostorg/type_index.git
synced 2025-07-30 04:17:17 +02:00
Fixed notes mentioned by Klaim - Joël Lamotte during review
This commit is contained in:
@ -23,28 +23,54 @@ void foo(T) {
|
||||
|
||||
struct user_defined_type{};
|
||||
|
||||
namespace ns1 { namespace ns2 {
|
||||
struct user_defined_type{};
|
||||
}} // namespace ns1::ns2
|
||||
|
||||
namespace {
|
||||
struct in_anon_type{};
|
||||
} // anonymous namespace
|
||||
|
||||
int main() {
|
||||
// Call to
|
||||
foo(1);
|
||||
// will output something like this:
|
||||
//
|
||||
// (RTTI on) (RTTI off)
|
||||
// Short name: i Short name: int]
|
||||
// Readable name: int Readable name: int
|
||||
// (RTTI on) (RTTI off)
|
||||
// Short name: i Short name: int]
|
||||
// Readable name: int Readable name: int
|
||||
|
||||
user_defined_type t;
|
||||
foo(t);
|
||||
// Will output:
|
||||
//
|
||||
// (RTTI on) (RTTI off)
|
||||
// Short name: 17user_defined_type user_defined_type]
|
||||
// Readable name: user_defined_type user_defined_type
|
||||
// (RTTI on) (RTTI off)
|
||||
// Short name: 17user_defined_type user_defined_type]
|
||||
// Readable name: user_defined_type user_defined_type
|
||||
|
||||
ns1::ns2::user_defined_type t_in_ns;
|
||||
foo(t_in_ns);
|
||||
// Will output:
|
||||
//
|
||||
// (RTTI on) (RTTI off)
|
||||
// Short name: N3ns13ns217user_defined_typeE ns1::ns2::user_defined_type]
|
||||
// Readable name: ns1::ns2::user_defined_type ns1::ns2::user_defined_type
|
||||
|
||||
in_anon_type anon_t;
|
||||
foo(anon_t);
|
||||
// Will output:
|
||||
//
|
||||
// (RTTI on) (RTTI off)
|
||||
// Short name: N12_GLOBAL__N_112in_anon_typeE {anonymous}::in_anon_type]
|
||||
// Readable name: (anonymous namespace)::in_anon_type {anonymous}::in_anon_type
|
||||
}
|
||||
|
||||
/*`
|
||||
Short names are very compiler dependant: some compiler will output `.H`, others `i`.
|
||||
|
||||
Readable names may also differ between compilers: `struct user_defined_type`, `user_defined_type`.
|
||||
|
||||
[warning With RTTI off different classes with same names in anonymous namespace may collapse. See 'RTTI emulation limitations'. ]
|
||||
*/
|
||||
|
||||
//] [/type_index_names_example]
|
||||
|
Reference in New Issue
Block a user