Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/variant/test/class_a.cpp @ 29

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: 1.2 KB
Line 
1//-----------------------------------------------------------------------------
2// boost-libs variant/test/class_a.cpp source file
3// See http://www.boost.org for updates, documentation, and revision history.
4//-----------------------------------------------------------------------------
5//
6// Copyright (c) 2003
7// Eric Friedman, Itay Maman
8//
9// Distributed under the Boost Software License, Version 1.0. (See
10// accompanying file LICENSE_1_0.txt or copy at
11// http://www.boost.org/LICENSE_1_0.txt)
12
13#include <algorithm> // for std::swap
14#include <sstream>
15#include <iostream>
16#include <assert.h>
17
18#include "class_a.h"
19
20
21using namespace std;
22
23class_a::~class_a()
24{
25   assert(self_p_ == this);
26}
27
28class_a::class_a(int n)
29{
30   n_ = n;
31   self_p_ = this;
32}
33
34class_a::class_a(const class_a& other)
35{
36   n_ = other.n_;
37   self_p_ = this;
38}
39
40
41class_a& class_a::operator=(const class_a& rhs)
42{
43   class_a temp(rhs);
44   swap(temp);
45
46   return *this;
47}
48
49void class_a::swap(class_a& other)
50{
51   std::swap(n_, other.n_);
52}
53
54int class_a::get() const
55{
56   return n_;
57}
58
59
60
61
62std::ostream& operator<<(std::ostream& strm, const class_a& a)
63{
64   return strm << "class_a(" << a.get() << ")";
65}
Note: See TracBrowser for help on using the repository browser.