new header to define some class partially noncopyable
This commit is contained in:
parent
016a739a5c
commit
e073d05f58
3 changed files with 62 additions and 11 deletions
|
|
@ -50,6 +50,7 @@
|
|||
|
||||
#include "lib/error.hpp"
|
||||
#include "lib/iter-adapter.hpp"
|
||||
#include "lib/nocopy.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <deque>
|
||||
|
|
@ -57,7 +58,6 @@
|
|||
|
||||
namespace lib {
|
||||
|
||||
|
||||
namespace {
|
||||
using util::unConst;
|
||||
|
||||
|
|
|
|||
59
src/lib/nocopy.hpp
Normal file
59
src/lib/nocopy.hpp
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
NOCOPY.hpp - some flavours of non-copyable entities
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2012, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LIB_NOCOPY_H
|
||||
#define LIB_NOCOPY_H
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
|
||||
|
||||
namespace util {
|
||||
|
||||
/**
|
||||
* any copy and copy construction prohibited
|
||||
*/
|
||||
class no_copy
|
||||
: boost::noncopyable
|
||||
{ };
|
||||
|
||||
/**
|
||||
* classes inheriting from this mixin
|
||||
* may be created by copy-construction,
|
||||
* but any copy-assignment is prohibited.
|
||||
* @note especially this allows returning
|
||||
* by-value from a builder function,
|
||||
* while prohibiting any further copy
|
||||
*/
|
||||
class no_copy_by_client
|
||||
{
|
||||
protected:
|
||||
~no_copy_by_client() {}
|
||||
no_copy_by_client() {}
|
||||
no_copy_by_client (no_copy_by_client const&) {}
|
||||
no_copy_by_client const&
|
||||
operator=(no_copy_by_client const&) { return *this; }
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
#endif /*LIB_NOCOPY_H*/
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
#include "lib/bool-checkable.hpp"
|
||||
#include "lib/typed-counter.hpp"
|
||||
#include "lib/iter-adapter.hpp"
|
||||
#include "lib/nocopy.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
|
@ -52,15 +53,6 @@ namespace session {
|
|||
using std::tr1::function;
|
||||
using std::string;
|
||||
|
||||
class no_copy_by_client
|
||||
{
|
||||
protected:
|
||||
~no_copy_by_client() {}
|
||||
no_copy_by_client() {}
|
||||
no_copy_by_client (no_copy_by_client const&) {}
|
||||
no_copy_by_client const&
|
||||
operator=(no_copy_by_client const&) { return *this; }
|
||||
};
|
||||
|
||||
class Goal;
|
||||
class Resolution;
|
||||
|
|
@ -77,7 +69,7 @@ namespace session {
|
|||
* Query ABC
|
||||
*/
|
||||
class Goal
|
||||
: no_copy_by_client
|
||||
: util::no_copy_by_client
|
||||
{
|
||||
public:
|
||||
virtual ~Goal() ;
|
||||
|
|
|
|||
Loading…
Reference in a new issue