Last change
on this file since 29 was
29,
checked in by landauf, 16 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
853 bytes
|
Line | |
---|
1 | // (C) Copyright Terje Slettebo 2001. |
---|
2 | // (C) Copyright John Maddock 2001. |
---|
3 | // Use, modification and distribution are subject to the |
---|
4 | // Boost Software License, Version 1.0. (See accompanying file |
---|
5 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
---|
6 | |
---|
7 | // See http://www.boost.org/libs/config for most recent version. |
---|
8 | |
---|
9 | // MACRO: BOOST_HAS_NRVO |
---|
10 | // TITLE: Named return value optimisation. |
---|
11 | // DESCRIPTION: Named return value optimisation. |
---|
12 | |
---|
13 | |
---|
14 | namespace boost_has_nrvo |
---|
15 | { |
---|
16 | |
---|
17 | class test_class |
---|
18 | { |
---|
19 | public: |
---|
20 | test_class() {} |
---|
21 | test_class(const test_class &other) |
---|
22 | { |
---|
23 | ++copy_count; |
---|
24 | } |
---|
25 | |
---|
26 | static int copy_count; |
---|
27 | }; |
---|
28 | |
---|
29 | int test_class::copy_count; |
---|
30 | |
---|
31 | test_class f() |
---|
32 | { |
---|
33 | test_class nrv; |
---|
34 | |
---|
35 | return nrv; |
---|
36 | } |
---|
37 | |
---|
38 | int test() |
---|
39 | { |
---|
40 | test_class::copy_count=0; |
---|
41 | |
---|
42 | f(); |
---|
43 | |
---|
44 | return test_class::copy_count; |
---|
45 | } |
---|
46 | |
---|
47 | } // namespace boost_has_nrvo |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | |
---|
Note: See
TracBrowser
for help on using the repository browser.