Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/utility/noncopyable_test.cpp @ 14

Last change on this file since 14 was 12, checked in by landauf, 17 years ago

added boost

File size: 982 bytes
Line 
1//  boost class noncopyable test program  ------------------------------------//
2
3//  (C) Copyright Beman Dawes 1999. Distributed under the Boost
4//  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 for most recent version including documentation.
8
9//  Revision History
10//   9 Jun 99  Add unnamed namespace
11//   2 Jun 99  Initial Version
12
13#include <boost/noncopyable.hpp>
14#include <iostream>
15
16//  This program demonstrates compiler errors resulting from trying to copy
17//  construct or copy assign a class object derived from class noncopyable.
18
19namespace
20{
21    class DontTreadOnMe : private boost::noncopyable
22    {
23    public:
24         DontTreadOnMe() { std::cout << "defanged!" << std::endl; }
25    };   // DontTreadOnMe
26
27}   // unnamed namespace
28
29int main()
30{
31    DontTreadOnMe object1;
32    DontTreadOnMe object2(object1);
33    object1 = object2;
34    return 0;
35}   // main
36 
Note: See TracBrowser for help on using the repository browser.