Takes care of proper special member generation globally, fixes #1689
Phew, a lot of classes were affected by this. The rationale for the
changes are as follows:
- When a type X declares any constructor, the default constructor is
not declared, so there is no need for X() = delete there. In fact,
there is brutal difference between those two: deleted members
participate in overload resolution, but not-declared members do not!
- When a type X wants to be non-copyable (e.g. to be only movable, like
threads, unique_ptrs, and so on), you can either do it by inheriting
from boost::noncopyable (the old way), or better declare both (!) the
copy constructor _and_ the copy assignment operator as deleted:
X(X const&) = delete;
X& operator=(X const&) = delete;
We had tons of types with deleted copy constructors that were lacking
a corresponding deleted copy assignment operator, making them still
copyable and you wouldn't even notice (read: scary)!
References:
- http://accu.org/content/conf2014/Howard_Hinnant_Accu_2014.pdf
- http://www.boost.org/doc/libs/master/libs/core/doc/html/core/noncopyable.html
Note: I know, I'm quoting Hinnant's extraordinary slides a lot, but
getting the sematic right here is so incredibly important.
This commit is contained in:
@@ -36,8 +36,8 @@ namespace extractor
|
||||
class EdgeBasedGraphFactory
|
||||
{
|
||||
public:
|
||||
EdgeBasedGraphFactory() = delete;
|
||||
EdgeBasedGraphFactory(const EdgeBasedGraphFactory &) = delete;
|
||||
EdgeBasedGraphFactory &operator=(const EdgeBasedGraphFactory &) = delete;
|
||||
|
||||
explicit EdgeBasedGraphFactory(std::shared_ptr<util::NodeBasedDynamicGraph> node_based_graph,
|
||||
const CompressedEdgeContainer &compressed_edge_container,
|
||||
@@ -62,7 +62,7 @@ class EdgeBasedGraphFactory
|
||||
const bool generate_edge_lookup);
|
||||
#endif
|
||||
|
||||
//The following get access functions destroy the content in the factory
|
||||
// The following get access functions destroy the content in the factory
|
||||
void GetEdgeBasedEdges(util::DeallocatingVector<EdgeBasedEdge> &edges);
|
||||
void GetEdgeBasedNodes(std::vector<EdgeBasedNode> &nodes);
|
||||
void GetStartPointMarkers(std::vector<bool> &node_is_startpoint);
|
||||
|
||||
@@ -38,10 +38,11 @@ class ExtractorCallbacks
|
||||
ExtractionContainers &external_memory;
|
||||
|
||||
public:
|
||||
ExtractorCallbacks() = delete;
|
||||
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
|
||||
explicit ExtractorCallbacks(ExtractionContainers &extraction_containers);
|
||||
|
||||
ExtractorCallbacks(const ExtractorCallbacks &) = delete;
|
||||
ExtractorCallbacks &operator=(const ExtractorCallbacks &) = delete;
|
||||
|
||||
// warning: caller needs to take care of synchronization!
|
||||
void ProcessNode(const osmium::Node ¤t_node, const ExtractionNode &result_node);
|
||||
|
||||
|
||||
@@ -23,9 +23,11 @@ namespace extractor
|
||||
class ScriptingEnvironment
|
||||
{
|
||||
public:
|
||||
ScriptingEnvironment() = delete;
|
||||
explicit ScriptingEnvironment(const std::string &file_name);
|
||||
|
||||
ScriptingEnvironment(const ScriptingEnvironment &) = delete;
|
||||
ScriptingEnvironment &operator=(const ScriptingEnvironment &) = delete;
|
||||
|
||||
lua_State *GetLuaState();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user