~ubuntu-branches/ubuntu/trusty/c++-annotations/trusty

« back to all changes in this revision

Viewing changes to yo/stl/definingshared.yo

  • Committer: Package Import Robot
  • Author(s): Frank B. Brokken
  • Date: 2012-01-20 11:53:17 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20120120115317-v4wiq9sttx72fabk
Tags: 9.1.0-1
New upstream release (covering C++11 to a large extend)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
and reference count of a temporary tt(shared_ptr). The temporary
23
23
tt(shared_ptr) is changed into a 0-pointer. An existing tt(shared_ptr) may
24
24
have its data moved to a newly defined tt(shared_ptr) (turning the existing
25
 
tt(shared_ptr) into a 0-pointer as well) by applying
26
 
hi(move)tt(std::move). Example:
 
25
tt(shared_ptr) into a 0-pointer as well). In the next example a temporary,
 
26
anonymous tt(shared_ptr) object is constructed, which is then used to
 
27
construct tt(grabber). Since tt(grabber)'s constructor receives an anonymous
 
28
temporary object, the compiler uses tt(shared_ptr)'s move constructor:
27
29
        verb(
28
30
    shared_ptr<string> grabber(shared_ptr<string>(new string("hi there")));
29
31
        )