← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/bug-1332627 into lp:widelands

 

Review: Needs Fixing

Great work!!! 

- I think we should be consistent about where to place these macros. 

1) Google style is to have them as the last thing in the class and always in a private statement. I like this because I am used to it and because it is already 'out there'. 
2) One could argue that being not copyable is part of the public API - so it should be in the face of the user of the class (around the constructor or so). It is never that important in practice though since most classes that are designed not be copied will only be copied on accident - and it is fine if the compiler gives a warning then.

I vote for 1 with a slight variation: For c++11 it is no longer necessary for this to be in the private section of the class, so I would just state 'as last statement in your class' in the codecheck rule. 

- Compile errors:

I think the problem you saw came from not delete'ing the copy constructor and operator=, but defining them and never declaring them. This is the prec++11 way of doing this macro - it has the disadvantage, that you promise the compiler to implement any constructor (the copy constructor) and so it no longer defines a default constructor for you. If you use the c++11 way:

#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&) = delete;   \
void operator=(const TypeName&) = delete

it should no longer complain. If am wrong and it still does adding a `TypeName() = default;` into the class that blows up should help out. 


Diff comments:

> === added file 'cmake/codecheck/rules/do_not_use_BOOST_noncopyable'
> --- cmake/codecheck/rules/do_not_use_BOOST_noncopyable	1970-01-01 00:00:00 +0000
> +++ cmake/codecheck/rules/do_not_use_BOOST_noncopyable	2014-07-14 05:56:47 +0000
> @@ -0,0 +1,18 @@
> +#!/usr/bin/python
> +
> +"""
> +Prefer DEBUG.

Fix comment or remove.

> +"""
> +
> +error_msg="Do not inherit from boost::noncopyable. Instead #include \"base/macros.h\" and add \"DISALLOW_COPY_AND_ASSIGN(<Objectname>);\" to the private section of the object or type."
> +
> +regexp=r"""(^#include.*boost.noncopyable\.hpp|noncopyable)"""
> +
> +forbidden = [
> +    "#include <boost/noncopyable.hpp>",
> +    "noncopyable"
> +]
> +
> +allowed = [
> +    "DISALLOW_COPY_AND_ASSIGN",
> +]
> 
> === modified file 'src/ai/ai_hints.h'
> --- src/ai/ai_hints.h	2014-07-12 20:37:13 +0000
> +++ src/ai/ai_hints.h	2014-07-14 05:56:47 +0000
> @@ -21,14 +21,19 @@
>  #define WL_AI_AI_HINTS_H
>  
>  #include <stdint.h>
> +<<<<<<< TREE
>  #include <boost/noncopyable.hpp>
> +=======
> +
> +#include "base/macros.h"
> +>>>>>>> MERGE-SOURCE
>  
>  struct Section;
>  
>  /// This struct is used to read out the data given in [aihints] section of a
>  /// buildings conf file. It is used to tell the computer player about the
>  /// special properties of a building.
> -struct BuildingHints : boost::noncopyable {
> +struct BuildingHints {
>  	BuildingHints(Section*);
>  	~BuildingHints();
>  
> @@ -94,6 +99,7 @@
>  	}
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(BuildingHints);
>  	char* renews_map_resource;
>  	char* mines_;
>  	bool basic_;
> 
> === modified file 'src/ai/computer_player.h'
> --- src/ai/computer_player.h	2014-07-05 16:41:51 +0000
> +++ src/ai/computer_player.h	2014-07-14 05:56:47 +0000
> @@ -20,8 +20,7 @@
>  #ifndef WL_AI_COMPUTER_PLAYER_H
>  #define WL_AI_COMPUTER_PLAYER_H
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "logic/game.h"
>  #include "logic/notification.h"
>  
> @@ -32,7 +31,6 @@
>   * \ref Implementation interface.
>   */
>  struct Computer_Player :
> -	boost::noncopyable,
>  	Widelands::NoteReceiver<Widelands::NoteImmovable>,
>  	Widelands::NoteReceiver<Widelands::NoteFieldPossession>
>  {
> @@ -72,6 +70,7 @@
>  	static const Implementation * getImplementation(const std::string & name);
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Computer_Player);
>  	Widelands::Game & m_game;
>  	Widelands::Player_Number const m_player_number;
>  };
> 
> === modified file 'src/base/macros.h'
> --- src/base/macros.h	2014-07-05 16:41:51 +0000
> +++ src/base/macros.h	2014-07-14 05:56:47 +0000
> @@ -65,6 +65,11 @@
>  #define DIAG_OFF(x) GCC_DIAG_OFF(x) CLANG_DIAG_OFF(x)
>  #define DIAG_ON(x) GCC_DIAG_ON(x) CLANG_DIAG_ON(x)
>  
> +// disallow copying or assigning a class
> +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
> +TypeName(const TypeName&);   \

= delete on both of them.

> +void operator=(const TypeName&)
> +
>  /// Wrapper macro around a dynamic_cast.
>  #define upcast(type, identifier, source) type * const identifier = \
>  dynamic_cast<type *>(source)
> 
> === modified file 'src/base/scoped_timer.h'
> --- src/base/scoped_timer.h	2014-07-05 16:41:51 +0000
> +++ src/base/scoped_timer.h	2014-07-14 05:56:47 +0000
> @@ -23,13 +23,13 @@
>  #include <string>
>  #include <stdint.h>
>  
> -#include <boost/noncopyable.hpp>
> +#include "base/macros.h"
>  
>  /**
>   * A cheap timer class that can be queried for timings and will print out
>   * it's total time in existence on destruction.
>   */
> -class ScopedTimer : boost::noncopyable {
> +class ScopedTimer {
>  public:
>  	// Takes the output message that will be boost::format() with the total time
>  	// this object existed (in ms, use %u).
> @@ -42,6 +42,7 @@
>  	uint32_t ms_since_last_query();
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(ScopedTimer);
>  	std::string message_;
>  	uint32_t startime_, lasttime_;
>  };
> 
> === modified file 'src/economy/economy.h'
> --- src/economy/economy.h	2014-07-05 16:41:51 +0000
> +++ src/economy/economy.h	2014-07-14 05:56:47 +0000
> @@ -27,6 +27,7 @@
>  #include <boost/function.hpp>
>  #include <boost/utility.hpp>
>  
> +#include "base/macros.h"
>  #include "logic/instances.h"
>  #include "logic/warelist.h"
>  #include "logic/wareworker.h"
> @@ -71,7 +72,7 @@
>   * connected by roads or the seafaring network - though of course, most code operates
>   * on the assumption that they are, with fallbacks for when they aren't.
>   */
> -class Economy : boost::noncopyable {
> +class Economy {
>  public:
>  	friend class EconomyDataPacket;
>  
> @@ -183,6 +184,7 @@
>  	void rebalance_supply() {_start_request_timer();}
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Economy);
>  /*************/
>  /* Functions */
>  /*************/
> 
> === modified file 'src/editor/tools/editor_tool.h'
> --- src/editor/tools/editor_tool.h	2014-07-05 16:41:51 +0000
> +++ src/editor/tools/editor_tool.h	2014-07-14 05:56:47 +0000
> @@ -22,8 +22,7 @@
>  
>  #define MAX_TOOL_AREA 9
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "editor/tools/editor_action_args.h"
>  #include "logic/widelands_geometry.h"
>  
> @@ -39,7 +38,7 @@
>   * one function (like delete_building, place building, modify building are 3
>   * tools).
>   */
> -class Editor_Tool : boost::noncopyable {
> +class Editor_Tool {
>  public:
>  	Editor_Tool(Editor_Tool & second, Editor_Tool & third, bool uda = true) :
>  		m_second(second), m_third(third), undoable(uda)
> @@ -102,6 +101,8 @@
>  protected:
>  	Editor_Tool & m_second, & m_third;
>  	bool undoable;
> +private:
> +	DISALLOW_COPY_AND_ASSIGN(Editor_Tool);
>  };
>  
>  #endif  // end of include guard: WL_EDITOR_TOOLS_EDITOR_TOOL_H
> 
> === modified file 'src/graphic/animation.cc'
> --- src/graphic/animation.cc	2014-07-12 20:37:13 +0000
> +++ src/graphic/animation.cc	2014-07-14 05:56:47 +0000
> @@ -33,6 +33,7 @@
>  #include "base/deprecated.h"
>  #include "base/i18n.h"
>  #include "base/log.h"
> +#include "base/macros.h"
>  #include "base/wexception.h"
>  #include "graphic/diranimations.h"
>  #include "graphic/graphic.h"
> @@ -55,7 +56,7 @@
>  namespace  {
>  
>  /// A class that makes iteration over filename_?.png templates easy.
> -class NumberGlob : boost::noncopyable {
> +class NumberGlob {
>  public:
>  	typedef uint32_t type;
>  	NumberGlob(const std::string& pictmp);
> @@ -64,6 +65,7 @@
>  	bool next(std::string* s);
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(NumberGlob);
>  	std::string templ_;
>  	std::string fmtstr_;
>  	std::string replstr_;
> 
> === modified file 'src/graphic/animation.h'
> --- src/graphic/animation.h	2014-07-05 16:41:51 +0000
> +++ src/graphic/animation.h	2014-07-14 05:56:47 +0000
> @@ -27,6 +27,7 @@
>  
>  #include <boost/utility.hpp>
>  
> +#include "base/macros.h"
>  #include "base/point.h"
>  #include "base/rect.h"
>  
> @@ -48,7 +49,7 @@
>   * The dimensions of an animation is constant and can not change from frame to
>   * frame.
>   */
> -class Animation : boost::noncopyable {
> +class Animation {
>  public:
>  	Animation() {}
>  	virtual ~Animation() {}
> @@ -87,6 +88,9 @@
>  
>  	/// Play the sound effect associated with this animation at the given time.
>  	virtual void trigger_soundfx(uint32_t time, uint32_t stereo_position) const = 0;
> +
> +private:
> +	DISALLOW_COPY_AND_ASSIGN(Animation);
>  };
>  
>  /**
> 
> === modified file 'src/graphic/image_cache.h'
> --- src/graphic/image_cache.h	2014-07-05 19:33:23 +0000
> +++ src/graphic/image_cache.h	2014-07-14 05:56:47 +0000
> @@ -25,6 +25,7 @@
>  
>  #include <boost/utility.hpp>
>  
> +#include "base/macros.h"
>  #include "graphic/image.h"
>  
>  class SurfaceCache;
> @@ -36,7 +37,7 @@
>  // its hash is not found. Other parts of Widelands will create images when they
>  // do not exist in the cache yet and then put it into the cache and therefore
>  // releasing their ownership.
> -class ImageCache : boost::noncopyable {
> +class ImageCache {
>  public:
>  	// Does not take ownership.
>  	ImageCache(SurfaceCache* surface_cache);
> @@ -56,6 +57,7 @@
>  	bool has(const std::string& hash) const;
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(ImageCache);
>  	typedef std::map<std::string, const Image*> ImageMap;
>  
>  	ImageMap images_;  /// hash of cached filename/image pairs
> 
> === modified file 'src/graphic/render/gamerenderer.h'
> --- src/graphic/render/gamerenderer.h	2014-07-05 16:41:51 +0000
> +++ src/graphic/render/gamerenderer.h	2014-07-14 05:56:47 +0000
> @@ -22,6 +22,7 @@
>  
>  #include <boost/utility.hpp>
>  
> +#include "base/macros.h"
>  #include "base/point.h"
>  
>  namespace Widelands {
> @@ -41,7 +42,7 @@
>   * so that target-specific optimizations (such as caching data) can
>   * be effective.
>   */
> -class GameRenderer : boost::noncopyable {
> +class GameRenderer {
>  public:
>  	GameRenderer();
>  	virtual ~GameRenderer();
> @@ -93,6 +94,7 @@
>  	/*@}*/
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(GameRenderer);
>  	void draw_wrapper();
>  };
>  
> 
> === modified file 'src/graphic/surface_cache.h'
> --- src/graphic/surface_cache.h	2014-07-05 16:41:51 +0000
> +++ src/graphic/surface_cache.h	2014-07-14 05:56:47 +0000
> @@ -24,6 +24,8 @@
>  
>  #include <boost/utility.hpp>
>  
> +#include "base/macros.h"
> +
>  class Surface;
>  
>  // Caches Surfaces. It contains surfaces which must not be deleted and
> @@ -33,7 +35,7 @@
>  // Nobody in Widelands should hold onto a Surface they get from this class,
>  // instead, they should use it only temporarily and rerequest it whenever they
>  // need it.
> -class SurfaceCache : boost::noncopyable {
> +class SurfaceCache {
>  public:
>  	SurfaceCache() {}
>  	virtual ~SurfaceCache() {}
> @@ -50,6 +52,8 @@
>  	// automatically - use this if surfaces are around for a long time and
>  	// recreation is expensive (i.e. images loaded from disk).
>  	virtual Surface* insert(const std::string& hash, Surface*, bool transient) = 0;
> +private:
> +	DISALLOW_COPY_AND_ASSIGN(SurfaceCache);
>  };
>  
>  // Create a new Cache whichs combined pixels in all transient surfaces are
> 
> === modified file 'src/io/filesystem/filesystem.h'
> --- src/io/filesystem/filesystem.h	2014-07-05 16:41:51 +0000
> +++ src/io/filesystem/filesystem.h	2014-07-14 05:56:47 +0000
> @@ -28,7 +28,6 @@
>  #include <vector>
>  
>  #include <stdint.h>
> -#include <boost/noncopyable.hpp>
>  
>  #include "io/filesystem/filesystem_exceptions.h"
>  
> 
> === modified file 'src/io/streamread.h'
> --- src/io/streamread.h	2014-07-05 16:41:51 +0000
> +++ src/io/streamread.h	2014-07-14 05:56:47 +0000
> @@ -23,8 +23,7 @@
>  #include <cstring>
>  #include <string>
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "base/wexception.h"
>  #include "machdep.h"
>  
> @@ -42,7 +41,7 @@
>   *
>   * Convenience functions are provided for many data types.
>   */
> -class StreamRead : boost::noncopyable {
> +class StreamRead {
>  public:
>  	explicit StreamRead() {}
>  	virtual ~StreamRead();
> @@ -77,6 +76,9 @@
>  		_data_error(char const * const fmt, ...) PRINTF_FORMAT(2, 3);
>  	};
>  #define data_error(...) _data_error(__VA_ARGS__)
> +
> +private:
> +	DISALLOW_COPY_AND_ASSIGN(StreamRead);
>  };
>  
>  #endif  // end of include guard: WL_IO_STREAMREAD_H
> 
> === modified file 'src/io/streamwrite.h'
> --- src/io/streamwrite.h	2014-07-05 16:41:51 +0000
> +++ src/io/streamwrite.h	2014-07-14 05:56:47 +0000
> @@ -25,8 +25,6 @@
>  #include <limits>
>  #include <string>
>  
> -#include <boost/noncopyable.hpp>
> -
>  #include "base/macros.h"
>  #include "machdep.h"
>  
> @@ -40,7 +38,7 @@
>   *
>   * Convenience functions are provided for many data types.
>   */
> -class StreamWrite : boost::noncopyable {
> +class StreamWrite {
>  public:
>  	explicit StreamWrite() {}
>  	virtual ~StreamWrite();
> @@ -90,6 +88,9 @@
>  	//  Write strings without null terminator.
>  	void Text   (char        const * const x) {Data(x,         strlen(x));}
>  	void Text   (const std::string &       x) {Data(x.c_str(), x.size());}
> +
> +private:
> +	DISALLOW_COPY_AND_ASSIGN(StreamWrite);
>  };
>  
>  #endif  // end of include guard: WL_IO_STREAMWRITE_H
> 
> === modified file 'src/logic/cookie_priority_queue.h'
> --- src/logic/cookie_priority_queue.h	2014-07-05 16:41:51 +0000
> +++ src/logic/cookie_priority_queue.h	2014-07-14 05:56:47 +0000
> @@ -25,7 +25,7 @@
>  #include <limits>
>  #include <vector>
>  
> -#include <boost/noncopyable.hpp>
> +#include "base/macros.h"
>  
>  template<typename _Type>
>  struct default_cookie_accessor;
> @@ -36,7 +36,7 @@
>  	typedef std::vector<type *> container;
>  	typedef typename container::size_type size_type;
>  
> -	struct cookie : boost::noncopyable {
> +	struct cookie {
>  		cookie() : pos(bad_pos()) {}
>  		~cookie() {}
>  
> @@ -44,6 +44,7 @@
>  		bool is_active() const {return pos != bad_pos();}
>  
>  	private:
> +		DISALLOW_COPY_AND_ASSIGN(cookie);
>  		friend struct cookie_priority_queue_base<_Type>;
>  
>  		size_type pos;
> 
> === modified file 'src/logic/editor_game_base.h'
> --- src/logic/editor_game_base.h	2014-07-05 16:41:51 +0000
> +++ src/logic/editor_game_base.h	2014-07-14 05:56:47 +0000
> @@ -25,8 +25,7 @@
>  #include <string>
>  #include <vector>
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "logic/bob.h"
>  #include "logic/building.h"
>  #include "logic/map.h"
> @@ -55,7 +54,6 @@
>  struct AttackController;
>  
>  class Editor_Game_Base :
> -	boost::noncopyable,
>  	NoteReceiver<NoteImmovable>,
>  	NoteReceiver<NoteFieldPossession>,
>  	NoteReceiver<NoteFieldTransformed>
> @@ -171,6 +169,7 @@
>  	World* mutable_world();
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Editor_Game_Base);
>  	// FIXME -- SDL returns time as uint32. Why do I have int32 ? Please comment or change this to uint32.
>  	int32_t gametime_;
>  	Object_Manager objects_;
> 
> === modified file 'src/logic/expedition_bootstrap.h'
> --- src/logic/expedition_bootstrap.h	2014-07-05 16:41:51 +0000
> +++ src/logic/expedition_bootstrap.h	2014-07-14 05:56:47 +0000
> @@ -23,8 +23,7 @@
>  #include <vector>
>  #include <memory>
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "economy/wares_queue.h"
>  
>  namespace Widelands {
> @@ -43,7 +42,7 @@
>  // Handles the mustering of workers and wares in a port for one Expedition. This
>  // object is created in the port dock as soon as the start expedition button is
>  // pressed. As soon as the ship is loaded, this object gets destroyed.
> -class ExpeditionBootstrap : boost::noncopyable {
> +class ExpeditionBootstrap {
>  public:
>  	ExpeditionBootstrap(PortDock* const portdock);
>  	virtual ~ExpeditionBootstrap();
> @@ -82,6 +81,7 @@
>  	void save(FileWrite& fw, Game& game, Map_Map_Object_Saver& mos);
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(ExpeditionBootstrap);
>  	struct ExpeditionWorker;
>  
>  	// Handles arriving workers and wares.
> 
> === modified file 'src/logic/instances.h'
> --- src/logic/instances.h	2014-07-05 16:41:51 +0000
> +++ src/logic/instances.h	2014-07-14 05:56:47 +0000
> @@ -27,7 +27,6 @@
>  #include <vector>
>  
>  #include <boost/function.hpp>
> -#include <boost/noncopyable.hpp>
>  #include <boost/unordered_map.hpp>
>  #include <boost/signals2.hpp>
>  
> @@ -53,7 +52,7 @@
>   * Base class for descriptions of worker, files and so on. This must just
>   * link them together
>   */
> -struct Map_Object_Descr : boost::noncopyable {
> +struct Map_Object_Descr {
>  	Map_Object_Descr(const std::string& init_name, const std::string& init_descname)
>  	   : m_name(init_name), m_descname(init_descname) {
>  	}
> @@ -91,6 +90,7 @@
>  	void add_attribute(uint32_t attr);
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Map_Object_Descr);
>  	typedef std::map<std::string, uint32_t> Anims;
>  	typedef std::map<std::string, uint32_t> AttribMap;
>  	typedef std::vector<uint32_t>           Attributes;
> @@ -148,7 +148,7 @@
>        return ref_cast<type const, Map_Object_Descr const>(*m_descr);          \
>     }                                                                          \
>  
> -class Map_Object : boost::noncopyable {
> +class Map_Object {
>  	friend struct Object_Manager;
>  	friend struct Object_Ptr;
>  
> @@ -326,6 +326,9 @@
>  	const Map_Object_Descr * m_descr;
>  	Serial                   m_serial;
>  	LogSink                * m_logsink;
> +
> +private:
> +	DISALLOW_COPY_AND_ASSIGN(Map_Object);
>  };
>  
>  inline int32_t get_reverse_dir(int32_t const dir) {
> @@ -337,7 +340,7 @@
>   *
>   * Keeps the list of all objects currently in the game.
>   */
> -struct Object_Manager : boost::noncopyable {
> +struct Object_Manager  {
>  	typedef boost::unordered_map<Serial, Map_Object *> objmap_t;
>  
>  	Object_Manager() {m_lastserial = 0;}
> @@ -372,6 +375,7 @@
>  	std::vector<Serial> all_object_serials_ordered () const;
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Object_Manager);
>  	Serial   m_lastserial;
>  	objmap_t m_objects;
>  };
> 
> === modified file 'src/logic/message_queue.h'
> --- src/logic/message_queue.h	2014-07-05 16:41:51 +0000
> +++ src/logic/message_queue.h	2014-07-14 05:56:47 +0000
> @@ -23,14 +23,13 @@
>  #include <cassert>
>  #include <map>
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "logic/message.h"
>  #include "logic/message_id.h"
>  
>  namespace Widelands {
>  
> -struct MessageQueue : boost::noncopyable, private std::map<Message_Id, Message *> {
> +struct MessageQueue : private std::map<Message_Id, Message *> {
>  	friend class Map_Players_Messages_Data_Packet;
>  	// Make typedefs public so that this looks like proper
>  	// STL container to templated algorithms.
> @@ -152,6 +151,8 @@
>  	}
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(MessageQueue);
> +
>  	/// Only for working around bugs in map loading code. If something has
>  	/// accidentally been added to the queue during load, it can be worked
>  	/// around by clearing the queue before the saved messages are loaded into
> 
> === modified file 'src/logic/player.h'
> --- src/logic/player.h	2014-07-05 16:41:51 +0000
> +++ src/logic/player.h	2014-07-14 05:56:47 +0000
> @@ -20,6 +20,7 @@
>  #ifndef WL_LOGIC_PLAYER_H
>  #define WL_LOGIC_PLAYER_H
>  
> +#include "base/macros.h"
>  #include "graphic/color.h"
>  #include "logic/building.h"
>  #include "logic/constants.h"
> @@ -54,7 +55,6 @@
>   * properly.
>   */
>  class Player :
> -	boost::noncopyable,
>  	public NoteReceiver<NoteImmovable>, public NoteReceiver<NoteFieldPossession>,
>  	public NoteSender  <NoteImmovable>, public NoteSender  <NoteFieldPossession>
>  {
> @@ -140,7 +140,7 @@
>  	};
>  
>  	/// Per-player field information.
> -	struct Field : boost::noncopyable {
> +	struct Field {
>  		Field() :
>  			military_influence(0),
>  			vision            (0),
> @@ -352,6 +352,8 @@
>  		//  border_br
>  		//  border_bl
>  		//  <end>                           0x100         0x160
> +		private:
> +			DISALLOW_COPY_AND_ASSIGN(Field);
>  	};
>  
>  	const Field * fields() const {return m_fields;}
> @@ -539,6 +541,8 @@
>  		(Building *, Building_Index const index_of_new_building);
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Player);
> +
>  	MessageQueue           m_messages;
>  
>  	Editor_Game_Base     & m_egbase;
> 
> === modified file 'src/logic/terrain_affinity.h'
> --- src/logic/terrain_affinity.h	2014-07-06 08:25:05 +0000
> +++ src/logic/terrain_affinity.h	2014-07-14 05:56:47 +0000
> @@ -22,8 +22,7 @@
>  
>  #include <string>
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "logic/description_maintainer.h"
>  
>  class LuaTable;
> @@ -38,7 +37,7 @@
>  // Describes the parameters and the pickiness of Immovables towards terrain
>  // parameters. Alls immovables that use 'grow' in any of their programs must
>  // define this.
> -class TerrainAffinity : boost::noncopyable {
> +class TerrainAffinity {
>  public:
>  	explicit TerrainAffinity(const LuaTable& table, const std::string& immovable_name);
>  
> @@ -56,6 +55,7 @@
>  	double pickiness() const;
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(TerrainAffinity);
>  	double preferred_fertility_;
>  	double preferred_humidity_;
>  	double preferred_temperature_;
> 
> === modified file 'src/logic/tribe.h'
> --- src/logic/tribe.h	2014-07-05 16:41:51 +0000
> +++ src/logic/tribe.h	2014-07-14 05:56:47 +0000
> @@ -23,6 +23,7 @@
>  #include <map>
>  #include <vector>
>  
> +#include "base/macros.h"
>  #include "graphic/animation.h"
>  #include "logic/bob.h"
>  #include "logic/building.h"
> @@ -51,7 +52,7 @@
>  buildings it can build and the associated graphics.
>  Two players can choose the same tribe.
>  */
> -struct Tribe_Descr : boost::noncopyable {
> +struct Tribe_Descr {
>  	Tribe_Descr(const std::string & name, Editor_Game_Base &);
>  
>  	//  Static function to check for tribes.
> @@ -172,6 +173,7 @@
>  	void resize_ware_orders(size_t maxLength);
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Tribe_Descr);
>  	const std::string m_name;
>  	uint32_t m_frontier_animation_id;
>  	uint32_t m_flag_animation_id;
> 
> === modified file 'src/logic/world/editor_category.h'
> --- src/logic/world/editor_category.h	2014-07-05 16:41:51 +0000
> +++ src/logic/world/editor_category.h	2014-07-14 05:56:47 +0000
> @@ -22,7 +22,7 @@
>  
>  #include <string>
>  
> -#include <boost/noncopyable.hpp>
> +#include "base/macros.h"
>  
>  class Image;
>  class LuaTable;
> @@ -31,7 +31,7 @@
>  
>  /// Represents a category for grouping items in the Editor, so purely a UI
>  /// distinction and not a logical one.
> -class EditorCategory : boost::noncopyable {
> +class EditorCategory {
>  public:
>  	EditorCategory(const LuaTable& table);
>  
> @@ -45,6 +45,7 @@
>  	const Image* picture() const;
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(EditorCategory);
>  	const std::string name_;
>  	const std::string descname_;
>  	const std::string image_file_;
> 
> === modified file 'src/logic/world/resource_description.h'
> --- src/logic/world/resource_description.h	2014-07-05 16:41:51 +0000
> +++ src/logic/world/resource_description.h	2014-07-14 05:56:47 +0000
> @@ -23,15 +23,14 @@
>  #include <string>
>  #include <vector>
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "logic/widelands.h"
>  
>  class LuaTable;
>  
>  namespace Widelands {
>  
> -class ResourceDescription : boost::noncopyable {
> +class ResourceDescription {
>  public:
>  	struct EditorPicture {
>  		std::string picname;
> @@ -57,6 +56,7 @@
>  	const std::string& get_editor_pic(uint32_t amount) const;
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(ResourceDescription);
>  	const std::string name_;
>  	const std::string descname_;
>  	const bool detectable_;
> 
> === modified file 'src/logic/world/terrain_description.h'
> --- src/logic/world/terrain_description.h	2014-07-06 08:17:24 +0000
> +++ src/logic/world/terrain_description.h	2014-07-14 05:56:47 +0000
> @@ -22,8 +22,7 @@
>  
>  #include <string>
>  
> -#include <boost/noncopyable.hpp>
> -
> +#include "base/macros.h"
>  #include "logic/widelands.h"
>  #include "logic/world/resource_description.h"
>  
> @@ -34,7 +33,7 @@
>  class EditorCategory;
>  class World;
>  
> -class TerrainDescription : boost::noncopyable {
> +class TerrainDescription {
>  public:
>  	enum Type {
>  		GREEN = 0,
> @@ -94,6 +93,7 @@
>  	double fertility() const;
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(TerrainDescription);
>  	const std::string name_;
>  	const std::string descname_;
>  	const EditorCategory* editor_category_;  ///< not owned.
> 
> === modified file 'src/logic/world/world.h'
> --- src/logic/world/world.h	2014-07-05 16:41:51 +0000
> +++ src/logic/world/world.h	2014-07-14 05:56:47 +0000
> @@ -22,6 +22,7 @@
>  
>  #include <memory>
>  
> +#include "base/macros.h"
>  #include "logic/bob.h"
>  #include "logic/description_maintainer.h"
>  
> @@ -36,7 +37,7 @@
>  
>  /// This is the in memory descriptions of the world and provides access to
>  /// terrains, immovables and resources.
> -class World : boost::noncopyable {
> +class World {
>  public:
>  	World();
>  	~World();  // Defined in .cc because all forward declarations are known then.
> @@ -83,6 +84,7 @@
>  	const DescriptionMaintainer<EditorCategory>& editor_immovable_categories() const;
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(World);
>  	std::unique_ptr<DescriptionMaintainer<BobDescr>> bobs_;
>  	std::unique_ptr<DescriptionMaintainer<Immovable_Descr>> immovables_;
>  	std::unique_ptr<DescriptionMaintainer<TerrainDescription>> terrains_;
> 
> === modified file 'src/map_io/s2map.cc'
> --- src/map_io/s2map.cc	2014-07-05 14:22:44 +0000
> +++ src/map_io/s2map.cc	2014-07-14 05:56:47 +0000
> @@ -229,7 +229,7 @@
>  /// Returns S2 terrain index into (pre one-world) terrain names. Those are then
>  /// looked up in the legacy conversion code and this gives the Widelands
>  /// terrain.
> -class TerrainConverter : boost::noncopyable {
> +class TerrainConverter {
>  public:
>  	TerrainConverter(const Widelands::World& world, const OneWorldLegacyLookupTable& lookup_table);
>  	Widelands::Terrain_Index lookup(S2_Map_Loader::WorldType world, int8_t c) const;
> @@ -238,6 +238,9 @@
>  	const OneWorldLegacyLookupTable& one_world_legacy_lookup_table_;
>  	const Widelands::World& world_;
>  	const std::map<S2_Map_Loader::WorldType, std::vector<std::string>> table_;
> +
> +private:
> +	DISALLOW_COPY_AND_ASSIGN(TerrainConverter);
>  };
>  
>  TerrainConverter::TerrainConverter
> 
> === modified file 'src/map_io/s2map.h'
> --- src/map_io/s2map.h	2014-07-05 16:41:51 +0000
> +++ src/map_io/s2map.h	2014-07-14 05:56:47 +0000
> @@ -22,6 +22,7 @@
>  
>  #include <string>
>  
> +#include "base/macros.h"
>  #include "map_io/map_loader.h"
>  
>  class FileRead;
> 
> === modified file 'src/profile/profile.h'
> --- src/profile/profile.h	2014-07-05 16:41:51 +0000
> +++ src/profile/profile.h	2014-07-14 05:56:47 +0000
> @@ -23,8 +23,6 @@
>  #include <cstring>
>  #include <vector>
>  
> -#include <boost/noncopyable.hpp>
> -
>  #include "base/macros.h"
>  #include "base/point.h"
>  #include "io/filesystem/layered_filesystem.h"
> @@ -188,7 +186,7 @@
>   * Returns the next unused section of the given name, or 0 if all sections
>   * have been used. name can be 0 to retrieve any remaining sections.
>   */
> -class Profile : boost::noncopyable {
> +class Profile {
>  public:
>  	enum {
>  		err_ignore = 0,
> @@ -233,6 +231,7 @@
>  	Section & create_section_duplicate(char const * name);
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Profile);
>  	std::string m_filename;
>  	typedef std::vector<Section> Section_list;
>  	Section_list m_sections;
> 
> === modified file 'src/ui_basic/panel.h'
> --- src/ui_basic/panel.h	2014-07-13 14:36:19 +0000
> +++ src/ui_basic/panel.h	2014-07-14 05:56:47 +0000
> @@ -27,9 +27,9 @@
>  #include <string>
>  
>  #include <SDL_keyboard.h>
> -#include <boost/noncopyable.hpp>
>  #include <boost/signals2/trackable.hpp>
>  
> +#include "base/macros.h"
>  #include "base/point.h"
>  
>  class RenderTarget;
> @@ -57,7 +57,7 @@
>   * its desired size changes, this automatically changes the actual size (which then invokes
>   * \ref layout and \ref move_inside_parent).
>   */
> -struct Panel : boost::signals2::trackable, boost::noncopyable {
> +struct Panel : boost::signals2::trackable {
>  	enum {
>  		pf_handle_mouse = 1, ///< receive mouse events
>  		pf_think = 2, ///< call think() function during run
> @@ -247,6 +247,7 @@
>  	static bool draw_tooltip(RenderTarget &, const std::string & text);
>  
>  private:
> +	DISALLOW_COPY_AND_ASSIGN(Panel);
>  	class CacheImage;
>  	friend class CacheImage;
>  
> 
> === modified file 'src/ui_basic/unique_window.h'
> --- src/ui_basic/unique_window.h	2014-07-05 16:41:51 +0000
> +++ src/ui_basic/unique_window.h	2014-07-14 05:56:47 +0000
> @@ -22,8 +22,6 @@
>  
>  #include <functional>
>  
> -#include "boost/noncopyable.hpp"
> -
>  #include "ui_basic/button.h"
>  #include "ui_basic/window.h"
>  
> 


-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1332627/+merge/226628
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1332627.


References