File: typetrait.yo

package info (click to toggle)
bobcat 6.02.02-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,960 kB
  • sloc: cpp: 18,954; fortran: 5,617; makefile: 2,787; sh: 659; perl: 401; ansic: 26
file content (90 lines) | stat: -rw-r--r-- 3,216 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
includefile(include/header)

COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::TypeTrait)(3bobcat)(_CurYrs_)(libbobcat-dev__CurVers_)
                    (Type traits)

manpagename(FBB::TypeTrait)(Type trait class)

manpagesynopsis()
    bf(#include <bobcat/typetrait>)nl()

manpagedescription()

    bf(FBB::TypeTrait) is a traits class. It does not define any member
functions or data members, but merely types. It can be used to determine the
basic type and other characteristics of (const) plain, (const) pointer or
(const) reference types. It was designed after Alexandrescu's (2001)
tt(TypeTraits) template class.

    The bf(FBB::LpromotesR) class template is used to determine, compile-time,
whether its second (right-hand side) template type can be promoted to its
first (left-hand side) template type.

    The bf(FBB::Use) class template expects two typenames tt(LHS) and tt(RHS)
and defines tt(typename Use<LHS, RHS>::type) as tt(LHS) if tt(RHS) can be
promoted to tt(LHS) or it defines tt(typename Use<LHS, RHS>::type) as tt(RHS).

includefile(include/namespace)

manpagesection(INHERITS FROM)
    -

manpagesection(TypeTrait<TYPE>)

    bf(TYPE) is the template type parameter whose characteristics must be
determined.

    tt(TypeTrait<TYPE>) defines the type tt(Plain): the plain type (the type
without const, pointer, reference type indication) of any const or non-const
plain, pointer, lvalue- or rvalue-reference type.

    tt(TypeTrait<TYPE>) defines the following tt(bool) values:
    itemization(
    itt(isClass): tt(true) if the template type argument represents a
        class (struct) type, tt(false) otherwise.
    itt(isConst): tt(true) if the template type argument represents a
        const type, tt(false) otherwise.
    itt(isPointer): tt(true) if the template type argument represents a
        pointer type, tt(false) otherwise.
    itt(isR_Ref): tt(true) if the template type argument represents a
        rvalue reference type, tt(false) otherwise.
    itt(isRef): tt(true) if the template type argument represents an
        lvalue reference type, tt(false) otherwise.
    )

manpagesection(LpromotesR<LeftType, RightType>)

    tt(LpromotesR<LeftType, RightType>) defines the enum constant tt(yes) as 1
if an tt(RightType) argument can be promoted to tt(LeftType) value or object.
The enum value tt(yes) is defined as 0 if no such constructor is available or if
such a constructor is defined using the tt(explicit) keyword.


manpagesection(EXAMPLES)


    Here is an example using tt(LpromotesR):
        verb(
    int main()
    {
        cout << "string promotes char const *: " <<
                LpromotesR<string, char const *>::yes << '\n';  // 1
        cout << "string promotes string " <<
                LpromotesR<string, string>::yes << '\n';        // 1
        cout << "char const * promotes string " <<
                LpromotesR<char const *, string>::yes << '\n';  // 0
    }
        )

manpagefiles()
    em(bobcat/typetrait) - defines the class interface

manpageseealso()
    bf(bobcat)(7)nl()
    Alexandrescu A. (2001) bf(Modern C++ Design), Addison-Wesley, Boston.

manpagebugs()
    None Reported.

includefile(include/trailer)