mirror of
https://github.com/boostorg/core.git
synced 2025-08-10 18:24:55 +02:00
The test was moved from Boost.Utility.
This commit is contained in:
36
test/noncopyable_test.cpp
Normal file
36
test/noncopyable_test.cpp
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
// boost class noncopyable test program ------------------------------------//
|
||||||
|
|
||||||
|
// (C) Copyright Beman Dawes 1999. Distributed under the Boost
|
||||||
|
// Software License, Version 1.0. (See accompanying file
|
||||||
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
|
// Revision History
|
||||||
|
// 9 Jun 99 Add unnamed namespace
|
||||||
|
// 2 Jun 99 Initial Version
|
||||||
|
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
// This program demonstrates compiler errors resulting from trying to copy
|
||||||
|
// construct or copy assign a class object derived from class noncopyable.
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class DontTreadOnMe : private boost::noncopyable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DontTreadOnMe() { std::cout << "defanged!" << std::endl; }
|
||||||
|
}; // DontTreadOnMe
|
||||||
|
|
||||||
|
} // unnamed namespace
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
DontTreadOnMe object1;
|
||||||
|
DontTreadOnMe object2(object1);
|
||||||
|
object1 = object2;
|
||||||
|
return 0;
|
||||||
|
} // main
|
||||||
|
|
Reference in New Issue
Block a user