diff options
Diffstat (limited to '')
-rw-r--r-- | src/tests/fstratsptr.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/tests/fstratsptr.cpp b/src/tests/fstratsptr.cpp new file mode 100644 index 0000000..343f682 --- /dev/null +++ b/src/tests/fstratsptr.cpp | |||
@@ -0,0 +1,46 @@ | |||
1 | #include "bu/fstring.h" | ||
2 | #include "bu/atom.h" | ||
3 | #include "bu/sptr.h" | ||
4 | |||
5 | class Person | ||
6 | { | ||
7 | public: | ||
8 | Person(){}; | ||
9 | virtual ~Person(){}; | ||
10 | |||
11 | Bu::Atom<Bu::FString> sFirstName; | ||
12 | Bu::Atom<Bu::FString> sLastName; | ||
13 | }; | ||
14 | |||
15 | typedef Bu::SPtr<Person> PersonPtr; | ||
16 | |||
17 | void Swap(PersonPtr one, PersonPtr two) | ||
18 | { | ||
19 | PersonPtr three(new Person); | ||
20 | three->sFirstName = one->sFirstName; | ||
21 | three->sLastName = two->sLastName; | ||
22 | |||
23 | printf( | ||
24 | "%s %s\n", | ||
25 | three->sFirstName->c_str(), | ||
26 | three->sLastName->c_str() ); | ||
27 | } | ||
28 | |||
29 | int main() | ||
30 | { | ||
31 | /* PersonPtr one(new Person); | ||
32 | PersonPtr two(new Person); | ||
33 | one->sFirstName = "Bob"; | ||
34 | one->sLastName = "Smith"; | ||
35 | two->sFirstName = "Fred"; | ||
36 | two->sLastName = "Carpenter"; | ||
37 | |||
38 | Swap(one, two); | ||
39 | */ | ||
40 | |||
41 | Bu::Atom<Bu::FString> sOne, sTwo; | ||
42 | sOne = "Hello"; | ||
43 | sTwo = sOne; | ||
44 | |||
45 | return 0; | ||
46 | } | ||