File: uniquemembers.yo

package info (click to toggle)
c%2B%2B-annotations 13.02.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,576 kB
  • sloc: cpp: 25,297; makefile: 1,523; ansic: 165; sh: 126; perl: 90; fortran: 27
file content (65 lines) | stat: -rw-r--r-- 3,185 bytes parent folder | download | duplicates (4)
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
The class tt(unique_ptr) offers the  following
 hi(unique_ptr: operators) operators:
    itemization(
    ithtq(operator=)
        (unique_ptr<Type> &operator=(unique_ptr<Type> &&tmp))
       (This operator transfers the memory pointed to by the i(rvalue)
        tt(unique_ptr) object to the i(lvalue) tt(unique_ptr) object using
        em(move semantics). So, the rvalue object em(loses) the memory it
        pointed at and turns into a 0-pointer. An existing tt(unique_ptr) may
        be assigned to another tt(unique_ptr) by converting it to an rvalue
        reference first using tt(std::move). Example:
   verb(unique_ptr<int> ip1(new int);
unique_ptr<int> ip2;

ip2 = std::move(ip1);)

)
    ithtq(operator bool)
        (operator bool() const)
       (This operator returns tt(false) if the tt(unique_ptr) does not point
        to memory (i.e., its tt(get) member, see below, returns 0). Otherwise,
        tt(true) is returned.)
    ithtq(operator*)(Type &operator*())
       (This operator returns a reference to the information accessible via
        a tt(unique_ptr) object . It acts like a normal pointer dereference
        operator.)
    ithtq(operator->)(Type *operator->())
       (This operator returns a pointer to the information accessible via a
        tt(unique_ptr) object. This operator allows you to select
        members of an object accessible via a tt(unique_ptr) object. Example:
   verb(unique_ptr<string> sp{ new string{ "hello" } };
cout << sp->c_str();)

)
    )

    The class tt(unique_ptr) supports the following hi(member function)
member functions:
    itemization(
    ithtq(get)(Type *get())
       (A pointer to the information controlled by the tt(unique_ptr) object
        is returned. It acts like tt(operator->). The returned pointer can be
        inspected. If it is zero the tt(unique_ptr) object does not point to
        any memory.)
    ithtq(get_deleter)(Deleter &unique_ptr<Type>::get_deleter())
       (A reference to the deleter object used by the tt(unique_ptr) is
        returned.)
    ithtq(release)(Type *release())
       (A pointer to the information accessible via a tt(unique_ptr) object is
        returned. At the same time the object itself becomes a 0-pointer
        (i.e., its pointer data member is turned into a 0-pointer). This
        member can be used to transfer the information accessible via a
        tt(unique_ptr) object to a plain tt(Type) pointer. After calling this
        member the proper destruction of the dynamically allocated memory
        is the i(responsibility of the programmer).)
    ithtq(reset)(void reset(Type *))
       (The dynamically allocated memory controlled by the tt(unique_ptr)
        object is returned to the common pool; the object thereupon controls
        the memory  to which the argument that is passed to the function
        points. It can also be called without argument, turning the object
        into a 0-pointer. This member function can be used to assign a new
        block of dynamically allocated memory to a tt(unique_ptr) object.)
    ithtq(swap)(void swap(unique_ptr<Type> &))
       (Two identically typed tt(unique_ptrs) are swapped.)
    )