os/ossrv/stdcpp/tsrc/Boost_test/variant/inc/class_a.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/stdcpp/tsrc/Boost_test/variant/inc/class_a.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,83 @@
     1.4 +//-----------------------------------------------------------------------------
     1.5 +// boost-libs variant/libs/test/class_a.h header file
     1.6 +// See http://www.boost.org for updates, documentation, and revision history.
     1.7 +//-----------------------------------------------------------------------------
     1.8 +//
     1.9 +// Copyright (c) 2003
    1.10 +// Eric Friedman, Itay Maman
    1.11 +//
    1.12 +// Distributed under the Boost Software License, Version 1.0. (See
    1.13 +// accompanying file LICENSE_1_0.txt or copy at
    1.14 +// http://www.boost.org/LICENSE_1_0.txt)
    1.15 +
    1.16 +#ifndef _CLASSA_H_INC_
    1.17 +#define _CLASSA_H_INC_
    1.18 +
    1.19 +#include <algorithm> // for std::swap
    1.20 +#include <sstream>
    1.21 +#include <iostream>
    1.22 +#include <assert.h>
    1.23 +#include <iosfwd>
    1.24 +
    1.25 +struct class_a
    1.26 +{
    1.27 +   ~class_a();
    1.28 +   class_a(int n = 5511);
    1.29 +   class_a(const class_a& other);
    1.30 +
    1.31 +   class_a& operator=(const class_a& rhs);
    1.32 +   void swap(class_a& other);
    1.33 +
    1.34 +   int get() const;
    1.35 +
    1.36 +private:
    1.37 +   int n_;
    1.38 +   class_a* self_p_;
    1.39 +
    1.40 +}; //Class_a
    1.41 +
    1.42 +std::ostream& operator<<(std::ostream& strm, const class_a& a);
    1.43 +
    1.44 +using namespace std;
    1.45 +class_a::~class_a()
    1.46 +{
    1.47 +   assert(self_p_ == this);
    1.48 +}
    1.49 +
    1.50 +class_a::class_a(int n)
    1.51 +{
    1.52 +   n_ = n;
    1.53 +   self_p_ = this;
    1.54 +}
    1.55 +
    1.56 +class_a::class_a(const class_a& other)
    1.57 +{
    1.58 +   n_ = other.n_;
    1.59 +   self_p_ = this;
    1.60 +}
    1.61 +
    1.62 +
    1.63 +class_a& class_a::operator=(const class_a& rhs)
    1.64 +{
    1.65 +   class_a temp(rhs);
    1.66 +   swap(temp);
    1.67 +
    1.68 +   return *this;
    1.69 +}
    1.70 +
    1.71 +void class_a::swap(class_a& other)
    1.72 +{
    1.73 +   std::swap(n_, other.n_);
    1.74 +}
    1.75 +
    1.76 +int class_a::get() const
    1.77 +{
    1.78 +   return n_;
    1.79 +}
    1.80 +
    1.81 +std::ostream& operator<<(std::ostream& strm, const class_a& a)
    1.82 +{
    1.83 +   return strm << "class_a(" << a.get() << ")";
    1.84 +}
    1.85 +
    1.86 +#endif //_CLASSA_H_INC_